Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Savable leaderboard?
- local ds = game:GetService("DataStoreService"):GetDataStore("--Cash01")
- game.Players.PlayerAdded:Connect(function(player)
- local key = "cash-"..player.userId
- local folder = Instance.new("Folder",player)
- folder.Name = "leaderstats" -- Must be lowercase
- local currency = Instance.new("IntValue",folder)
- currency.Name = "Cash" -- Name of your currency. Must match with the Currency in the CodeScript.
- currency.Value = 0 -- Starting Cash
- local save = ds:GetAsync(key)
- if save then
- currency.Value = save
- end
- currency.Changed:Connect(function()
- ds:SetAsync(key,currency.Value)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement