Tables cannot be cyclic

I’m attempting to pass multiple tables to the client through a RemoteFunction but for some reason every time I :InvokeServer the output spits out “tables cannot be cyclic”.
I’ve looked at other threads and found out the issue is when a table is referencing itself but I can’t seem to find where it’s doing this.

1 Like

Can you include the code you are using to build the table.

1 Like

This is what the tables look like:

local UserData = {
	forceallegiance = 'Light',
	race = 'Human',
	face = 'rbxassetid://31117192',
	shirt = 'rbxassetid://584186904',
	pants = 'rbxassetid://584186904',
	skincolor = {255, 234, 157},
	hair = 'MessyHairBrown',
	accessory = nil,
	haircolor = {88, 73, 58}
}
1 Like

I think you mean:

local UserData = {
	["forceallegiance"] = 'Light',
	["race"] = 'Human',
	["face"] = 'rbxassetid://31117192',
	["shirt"] = 'rbxassetid://584186904',
	["pants"] = 'rbxassetid://584186904',
	["skincolor"] = {255, 234, 157},
	["hair"] = 'MessyHairBrown',
	["accessory"] = nil,
	["haircolor"] = {88, 73, 58}
}

There must be more to the table than that example.

Are you using metatables? If you have the metatable’s .__index metamethod set to itself, it becomes cyclic.

3 Likes

The table creation is correct.

1 Like

Not using any metatables in inside the script

1 Like

All I can say would be to use the debugger to check the table content before you pass it over. Alternatively the crude approach is to put prints on each line to find the last line which was ran before the error.

The table you posted above is valid and will be send in a remote function.

What does this remote function return?

Ok, found out what the problem was. I was just sending the wrong table.

4 Likes