Serverside Tables and Clientside Tables are wrong

Hello!
So Im making a game where you can customize your avatar and use it for other game (tp game). Now I’ve got problems that when you get a new tables, It will not print the same order like it supposed to be, here is an example:
image
Both of the Accessories data are typed the same
game.Lighting.Glasses:GetChildren()
Which if example, the player chooses a googles. The server might saves the wrong data “Which in this case. A Eye patch”

Please help!

Hi!

I would suggest creating them like this:

local NewDefaultData = {
 [1] = "Data1",
 [2] = "Data2",
 [3] = "Data3",
}

Then you can loop through it with a ipairs for-loop, and it will always be in order. :slight_smile:

You could also turn it into a dictionary

local NewDefaultData = {
 [1] = {["Fog"]="Data1Fog",["Time"]="Data1Time"}
 [2] = {["Fog"]="Data2Fog",["Time"]="Data2Time"}
 [3] = {["Fog"]="Data3Fog",["Time"]="Data3Time"}
}

And then you can call them by the Index in the for-loop

for Index, DataValues in ipairs(NewDefaultData)
local Fog = NewDefaultData[Index]["Fog"]
local Time = NewDefaultData[Index]["Time"]
end