Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't this table saving work? And how to properly save a table?

So I have a table in a local script and i pass the table to a server script to save it

local script:

--this is how im passing the table to a server
remoteSaving:FireServer(table)

the table when i tested only had one value inside of it

server script (saving data):

remoteSaving.OnServerEvent:Connect(function(pl, table)
	Items = table
	ds1:SetAsync(pl.UserId, Items)
	print("saved data for"..pl.Name)
end)

then when a player joins i use PlayerAdded event to call a function for getting data, also in the same server script:

game.Players.PlayerAdded:Connect(function(pla)
	Items = ds1:GetAsync(pla.UserId) or {}
	remoteSaving:FireClient(pla, Items)
end)

and when I fire client with that table it crashes because my for loop where i go through the table acts like it has infinite amount of values in it

Anyone knows what im doing wrong?

1 answer

il try to fix your script im sorry if this does not help

--Local Script
save = nil
thingys = {"a,b,c"}
thingys:FireServer(thingys)
print(thingys)

This discussion is preserved as it was. New answers, comments, and votes are closed.