I just ran my project and, got a lot of errors and I have no idea what happened

3 Replies
Nightmare
NightmareOP3w ago
I am pretty worried about this error because something tells me it's because of import and like, yeah lol or if I even exported stuff the correct way Classes import dosen't support classes? gimme aminute box.ts
import { Item } from "shared/inventory";
import { items } from "./items";

const replicatedStorage = game.GetService("ReplicatedStorage");
const ItemsFolder = replicatedStorage.FindFirstChild("Items");

export class Box extends Item {
constructor() {
if (ItemsFolder && ItemsFolder.IsA("Folder")) {
const model = ItemsFolder.FindFirstChild("Box");
if (model && model.IsA("Model")) {
super("Box", model, "Very cool box!");
this.id = 2;
}
}
}

use(): void {
print("dumbass, box has no use");
}
}
import { Item } from "shared/inventory";
import { items } from "./items";

const replicatedStorage = game.GetService("ReplicatedStorage");
const ItemsFolder = replicatedStorage.FindFirstChild("Items");

export class Box extends Item {
constructor() {
if (ItemsFolder && ItemsFolder.IsA("Folder")) {
const model = ItemsFolder.FindFirstChild("Box");
if (model && model.IsA("Model")) {
super("Box", model, "Very cool box!");
this.id = 2;
}
}
}

use(): void {
print("dumbass, box has no use");
}
}
items(that's not a class, i forgot lol)
import { Box } from "./box";
import { Item } from "shared/inventory";

export const items: Record<string, typeof Item> = {
Item,
Box,
};
import { Box } from "./box";
import { Item } from "shared/inventory";

export const items: Record<string, typeof Item> = {
Item,
Box,
};
inventory
import { items } from "./inventoryItems/items";

export const StringToClass: Record<string, new (...args: never[]) => Item> = {
box: items["Box"],
};

export class Slot {
private item: Item | undefined = undefined;
constructor() {
print("slot created!");
}

addItem(Item: Item) {
if (this.item === undefined) {
this.item = Item;
print("Item Added into the slot!");
}
}

removeItem(): undefined {
if (this.item === undefined) {
print("Slot is empty, nothing was deleted");
} else {
this.item = undefined;
print("Item was removed from slot!");
}
}

useItem() {
if (this.item === undefined) {
print("Player has no item in this slot!");
} else {
this.item.use();
}
}

getInfo() {
if (this.item === undefined) {
return { undefined };
} else {
return this.item.getInfo();
}
}
}

export class Item {
public id: number;
private name: string;
private model: Model;
private description?: string;

constructor(name: string, model: Model, description: string) {
this.id = 1;
this.name = name;
this.model = model;
this.description = description;
}
use(): void {
print(`${this.name} used!`);
}

getInfo() {
return {
id: this.id,
name: this.name,
description: this.description,
model: this.model,
};
}
}
import { items } from "./inventoryItems/items";

export const StringToClass: Record<string, new (...args: never[]) => Item> = {
box: items["Box"],
};

export class Slot {
private item: Item | undefined = undefined;
constructor() {
print("slot created!");
}

addItem(Item: Item) {
if (this.item === undefined) {
this.item = Item;
print("Item Added into the slot!");
}
}

removeItem(): undefined {
if (this.item === undefined) {
print("Slot is empty, nothing was deleted");
} else {
this.item = undefined;
print("Item was removed from slot!");
}
}

useItem() {
if (this.item === undefined) {
print("Player has no item in this slot!");
} else {
this.item.use();
}
}

getInfo() {
if (this.item === undefined) {
return { undefined };
} else {
return this.item.getInfo();
}
}
}

export class Item {
public id: number;
private name: string;
private model: Model;
private description?: string;

constructor(name: string, model: Model, description: string) {
this.id = 1;
this.name = name;
this.model = model;
this.description = description;
}
use(): void {
print(`${this.name} used!`);
}

getInfo() {
return {
id: this.id,
name: this.name,
description: this.description,
model: this.model,
};
}
}
oh so circular import is like when i import from file A to file B but also import from file B to file A? oooh okey, thanks I am glad it's just this I was little worried
20:28:17.384 ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework:81: ServerScriptService.TS.services.inventory.service failed to preload (6ms): Module code did not return exactly one value - Server -
20:28:17.384 ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework:81: ServerScriptService.TS.services.inventory.service failed to preload (6ms): Module code did not return exactly one value - Server -
uh Now i have completly diffrent error i guess? server-client communication broke? like inventory.service or? I am confused too
import { Functions } from "server/network";
import { Slot } from "shared/inventory";
import { Item } from "shared/itemClass";
import { Functions } from "server/network";
import { Slot } from "shared/inventory";
import { Item } from "shared/itemClass";
this is all basically whole service is just for communication with client I have there whole class and then just call wrappers like this
Functions.createInventory.setCallback((plr: Player) => {
const newInventory = new Inventory(slotCount);
inventories[plr.UserId] = newInventory;
return newInventory.slotCount;
});
Functions.createInventory.setCallback((plr: Player) => {
const newInventory = new Inventory(slotCount);
inventories[plr.UserId] = newInventory;
return newInventory.slotCount;
});
whole log, I don't think so
20:28:17.384 Inventory manager initalized - Server - inventory.service:155
20:28:17.384 ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework:81: ServerScriptService.TS.services.inventory.service failed to preload (6ms): Module code did not return exactly one value - Server - flamework:81
20:28:17.384 Stack Begin - Studio
20:28:17.384 Script 'ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework', Line 81 - Studio - flamework:81
20:28:17.384 Script 'ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework', Line 91 - function _addPaths - Studio - flamework:91
20:28:17.385 Script 'ServerScriptService.TS.runtime', Line 5 - Studio - runtime:5
20:28:17.385 Stack End - Studio
20:28:18.864 slot created! - Server - inventory:21
20:28:18.864 inventory updated! - Server - inventory.service:99
20:28:18.864 slot created! - Server - inventory:21
20:28:18.865 inventory updated! - Server - inventory.service:99
20:28:18.865 slot created! - Server - inventory:21
20:28:18.866 inventory updated! - Server - inventory.service:99
20:28:18.866 slot created! - Server - inventory:21
20:28:18.866 inventory updated! - Server - inventory.service:99
20:28:18.867 slot created! - Server - inventory:21
20:28:18.868 inventory updated! - Server - inventory.service:99
20:28:17.384 Inventory manager initalized - Server - inventory.service:155
20:28:17.384 ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework:81: ServerScriptService.TS.services.inventory.service failed to preload (6ms): Module code did not return exactly one value - Server - flamework:81
20:28:17.384 Stack Begin - Studio
20:28:17.384 Script 'ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework', Line 81 - Studio - flamework:81
20:28:17.384 Script 'ReplicatedStorage.rbxts_include.node_modules.@flamework.core.out.flamework', Line 91 - function _addPaths - Studio - flamework:91
20:28:17.385 Script 'ServerScriptService.TS.runtime', Line 5 - Studio - runtime:5
20:28:17.385 Stack End - Studio
20:28:18.864 slot created! - Server - inventory:21
20:28:18.864 inventory updated! - Server - inventory.service:99
20:28:18.864 slot created! - Server - inventory:21
20:28:18.865 inventory updated! - Server - inventory.service:99
20:28:18.865 slot created! - Server - inventory:21
20:28:18.866 inventory updated! - Server - inventory.service:99
20:28:18.866 slot created! - Server - inventory:21
20:28:18.866 inventory updated! - Server - inventory.service:99
20:28:18.867 slot created! - Server - inventory:21
20:28:18.868 inventory updated! - Server - inventory.service:99
Oh i've noticed this today and i'll be at computer late
Nightmare
NightmareOP2w ago
inventory.service.luau
Nightmare
NightmareOP2w ago
oh i though it will work well when there is runtime.server.luau oh klol so jsut rename it for like inventory-service.ts? uh what does it even do lol

Did you find this page helpful?