Problem with module script

Hi all I have a problem that I have never come across before using module scripts, when I run this code in a script:


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"

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

	local NewTable = {}
	if (isServer) then
		NewTable = {
			ItemsCarrying = 0,
			petInventory = {},
			petCapacity = 10,
			CurrentlySelling = false,
			WaitTime = 0.6,
			EnergyIntake = 10
		NewTable = Remotes.CreateGameObject:InvokeServer()
	return setmetatable(NewTable,GameMechanics)