I have a leaderboard which saves values. The problem for me is it often fails and ruins peoples data. Is there another leaderboard which would be better? Here is my leaderboard:
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("JumpPowerSaveSystem")--change all "JumpPower" to what value you want and keep doing it
local ds2 = datastore:GetDataStore("RebirthsSaveSystem")--change all "Rebirths" to what value you want and keep doing it
local ds3 = datastore:GetDataStore("GemsSaveSystem")--change all "Rebirths" to what value you want and keep doing it
game.Players.PlayerAdded:connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local JumpPower = Instance.new("IntValue", folder)
JumpPower.Name = "JumpPower"
local Rebirths = Instance.new("IntValue", folder)
Rebirths.Name = "Rebirths"
local Gems = Instance.new("IntValue", folder)
Gems.Name = "Gems"
JumpPower.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, JumpPower.Value)
Rebirths.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, Rebirths.Value)
Gems.Value = ds3:GetAsync(plr.UserId) or 0
ds3:SetAsync(plr.UserId, Gems.Value)
game.Players.PlayerRemoving:Connect(function(plr)
ds1:SetAsync(plr.UserId, JumpPower.Value)
ds2:SetAsync(plr.UserId, Rebirths.Value)
ds3:SetAsync(plr.UserId, Gems.Value)
end)
end)

4 comments
your PlayerRemoving event's function should NOT be inside your PlayerAdded event's function. just move lines 25-29 below line 32
But then it makes the values blue.
Let me try it,
obviously.. you'll have to find the leaderstats, ie:
local leaderstats = plr:FindFirstChild("leaderstats") local jumppower = leaderstats.JumpPoweretc