Ok, so I was working on a commission, and the client wanted a leaderboard for his simulator. I don’t think I did anything wrong since I usually always use this for leaderstats
API Services are on, no output errors
local players = game:GetService("Players")
local datastore = game:GetService("DataStoreService")
local saveMoney = datastore:GetDataStore("MoneySaver")
local saveRebirths = datastore:GetDataStore("RebirthsSaver")
players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "Leaderboard"
folder.Parent = player
local Money = Instance.new("IntValue")
Money.Name = "Money"
Money.Parent = folder
Money.Value = saveMoney:GetAsync(player.UserId) or 0
saveMoney:SetAsync(player.UserId, Money.Value)
local Rebirths = Instance.new("IntValue")
Rebirths.Name = "Rebirths"
Rebirths.Parent = folder
Rebirths.Value = saveRebirths:GetAsync(player.UserId) or 0
saveRebirths:SetAsync(player.UserId, Rebirths.Value)
Money.Changed:connect(function()
saveMoney:SetAsync(player.UserId, Money.Value)
end)
Rebirths.Changed:connect(function()
saveRebirths:SetAsync(player.UserId, Rebirths.Value)
end)
end)