_G It's not working right

I want to display the ‘_G.inventoryPool’ global table class that I specified in the Normal Server Script from a module script, but I can’t manage it even though there are servers on both sides.

Although there is a server on both sides, I cannot see the global table from the module script.
image
image

I tried to transfer the global table to the module but I got the same result.

-- ModuleScript
local Manager = {}
local inventoryPool = _G.inventoryPool

function Manager:test()
	return inventoryPool
end

return Manager
--ServerScript
_G.inventoryPool = _G.inventoryPool or {}
local InventoryManager = require(game:GetService("ServerScriptService").Class.Manager)

local inventoryPool = _G.inventoryPool
1 Like

Put simply, _G exists separately between the client and server. They are different tables under the same name! You should use RemoteEvents or instances to convey important information to the client.

Also… it’s spelt Inventory. :pleading_face:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.