DataStore loading previous players data to new player

this is very confusing, can you send a video of the problem?

Let me explain in more detail.

If you are a new player and nobody else has been in the server, it gives you fresh clean data.

If you are a new player and join a server with other players in it., it won’t give you fresh data and will give you someone else’s data.

Show how it is setting the value to the datastorekey with setasync. Show the full playerremoving event.

Using table.clone only creates a shallow copy of a table which may be affecting your DataFormat dictionary/table. Try deep copying the table instead.

1 Like

i think table.clone deep clones the table

Adding onto what @RipPBB_TUD said, what is dataformat function aswell? Can you show that. Heck why are there so many functions, I think scripters are too used to just putting things in functions instead of writing out the actual code in the if statement. I usually prefer writing out the code instead of using functions, but that’s just me.

table | Documentation - Roblox Creator Hub

i just finded this:

local function deepCopy(original)
	local copy = {}
	for k, v in pairs(original) do
		if type(v) == "table" then
			v = deepCopy(v)
		end
		copy[k] = v
	end
	return copy
end
1 Like

Yep, that’s the commonly used deep copy function. OP should be using this instead of table.clone

1 Like

I will try deepCopy instead of clone then.

Haha this worked, thanks so much guys. All of that just to realise that table.clone() is not good enough.

1 Like

you would make me happy if you mark as solution

have a nice day :smiling_face_with_three_hearts:

and thanks @RipPBB_TUD , i thought table.clone was deep cloning a table :smiling_face_with_three_hearts:

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