Saving and loading leaderstats

Hey, so I have a leader stats code like this:

game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = Player

local Value = Instance.new("IntValue")
Value.Name = "Size"
Value.Parent = leaderstats
Value.Value = 0

local Value2 = Instance.new("IntValue")
Value2.Name = "Coins"
Value2.Parent = leaderstats
Value2.Value= 0

end)

I made it so that when the player clicks the size stat increase, and when the player touches a part the size value becomes 0, and the coin value increases.

I was wondering how I would autosave the stat value and make it load when a player joins, thanks,

I also would like to know how to make other players see your leaderstats

Other players can see leaderstats. Here’s some info on how to save player data.

1 Like

So I don’t have to add for a example a remote event to change the stat? I can just change it from the client?

If something is changed by the client, the server won’t know it and won’t save. You can fire a remote event when the value is changed so the server can know it changed.

1 Like

So I would fire a remote event and make it when the event is received it would change the stat?

Yep

30 chars

1 Like

okay thank you (30CHARACATERS)