For loop not working through player data

In order to load my player data, I pass it through a remote event, and then load the data that is in the dictionary to the player. However, when I try to do a for loop through the dictionary, it does not work. I am able to print the dictionary and all of it is there, on both the client and the server.
image
However, the script that loops through it does not work, and I get the error “attempt to call nil value.”

Script:

fireAddLoadedData.OnServerEvent:Connect(function(player, data)
	print(data)
	for _, accessory in pairs(data.Accessories:GetChildren()) do -- Errors here
		-- Does stuff
	end
end)

What I got from your post is that you’re having the client send some table over to the server.

Error msg explanation

The error message attempt to call nil value means you’re trying to do something like nil() from the eyes of the interpreter. nil represents no value so you can’t call it with the brackets (). Here GetChildren doesn’t seem to exist in data.Accessories yet you’re trying to call it anyway. Only Instances have a GetChildren method.

Try changing your pairs arg to just data.Accessories:

for _, accessory in pairs(data.Accessories) do

You can also just use generalized iteration:

for _, accessory in data.Accessories do

It would be more helpful if you can tell us the overarching goal of your code, rather than its expected behavior, as I feel like there might be another issue that will come into play.