It doesn’t print the correct items that I changed from inside the module script, it just leaves petIvnentory as empty even though I clearly changed it in the module script
self.petInventory["check"] = "one"
print(self)
Does anybody know why gameObject.petInventory[“check”] doesn’t exist inside the regular script?
I can’t really see the problem from this little bit of code but are you sure you’ve devined .petInventory as a table beforehand, and are you using this in a server script and local script?
This is when I define everything so petInventory is there, I change the values on server side and it works, just if I try to change the local script side it doesn’t carry from module to localscript
function GameMechanics.new(Player)
local NewTable = {}
if (isServer) then
NewTable = {
ItemsCarrying = 0,
petInventory = {},
petCapacity = 10,
CurrentlySelling = false,
WaitTime = 0.6,
EnergyIntake = 10
}
else
NewTable = Remotes.CreateGameObject:InvokeServer()
end
return setmetatable(NewTable,GameMechanics)
end