I'm going to spare you the details of my game and get the the point.

I have a dictionary of instance/value pairs on the server:


-----SERVER SCRIPT-----

local foo = {}

for x = 1,5 do

	foo[Instance.new("Part")] = {}

end

for key, value in pairs(foo) do

	print(key,value)

end

--[[

Output:
	
	Part table: 0x24dd7da55596b52c
	Part table: 0x448b37d894788afc
	Part table: 0xff1ec16c4e81d27c
	Part table: 0x99b57cb1c0332d6c
	Part table: 0x53847d3a3d35f3cc

]]

When I replicate the table foo from the server to the client via a remote function, the contents change:


-----LOCAL SCRIPT-----

local foo = RemoteFunction:InvokeServer()	--Reference to 'foo' from server script above

for key,value in pairs(foo) do

	print(key,value)

end

--[[

Output:

	<Instance> (Part) table: 0x28816fd1f62ff14c
]]

I'm guessing the problem is that Instance keys in tables are just converted to strings when tables are replicated from server to client, and so the key is replaced by a string formatted as <Instance> ([OBJECT_NAME]). I could've sworn that instance/value dictionaries replicate properly from client to server though. Maybe this is done in the name of security then?

Does anyone know about this interaction? Or any way to access an instance through it's UUID without going through the pain of implementing my own system?

2 comments

0

Assign it as global via _G.

0

Is there a way to make _G replicate across networks?