local Data = game:GetService("DataStoreService"):GetDataStore("DataStore")

game.Players.PlayerAdded:Connect(function(plr)
	local folder = Instance.new("Folder", plr)
	folder.Name = "leaderstats"
	
	local Throws = Instance.new("IntValue", folder)
	Throws.Name = "Throws"
	Throws.Value = 0
	
	local dataLoad = Data:GetAsync(tostring(plr.UserId))
	
	if dataLoad then
		Throws.Value = dataLoad[1]
	end
end)
game.Players.PlayerRemoving:Connect(function(plr)
	Data:SetAsync(tostring(plr.UserId),{
		plr.leaderstats.Throws.Value
	})
end)

it saves at the number '125'. Idk what wrong with it but even if i join to get more Throws it and when i join back it saves at 125. Even if i get more Throws.

5 comments

0

What doesn't exactly work?

0

edited it

1

I redact my earlier comment as I misread your code. Why are you saving the throws stat as a table instead of a numerical value? iirc tables automatically get stored as json strings. Also is there an error being thrown?

0

nope

0

it could have something to do with how you update the Throws value, if you're updating from the client that could be your issue.