For some reason the last 2 lines of code inside the :PlayerRemoving() aren't running. I'm currently trying to use a table inside of the datastore, so I don't have to use single datastores.

game.Players.PlayerRemoving:Connect(function(plr)
	local money = game.Players[tostring(plr.Name)].leaderstats.Money.Value
	local Stats = game:GetService("ReplicatedStorage").Stats[plr.Name].HeadsCaptured
	local Heads = {
		Flumpy = Stats.Flumpy.Value,
		Germany = Stats.Germany.Value,
		Ice = Stats.Ice.Value,
		Lava = Stats.Lava.Value,
		Meqolo = Stats.Meqolo.Value,
		Snow = Stats.Snow.Value,
		UK = Stats.UK.Value,
		USA = Stats.USA.Value
	}
	
	Money:SetAsync(plr.UserId, money)
	print("a")
	Heads:SetAsync(plr.UserId, {Stats.Flumpy.Value,Stats.Germany.Value,Stats.Ice.Value,Stats.Lava.Value,Stats.Meqolo.Value,Stats.Snow.Value,Stats.UK.Value,Stats.USA.Value})
end)

Any help is appreciated

3 comments

0

Instead of having to save each value inside the table, use JSONEncode. It will format/input everything into a string, and once you do just load it with JSONDecode

0

Can you include the rest of the script

0

liteImpulse can you explain how? ive been strugglign with the same issue as meqolo