Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dsService = game:GetService("DataStoreService")
- local ds = dsService:GetDataStore("MondStats")
- game.Players.PlayerAdded:Connect(function(plr)
- local folder = Instance.new("Folder", plr)
- folder.Name = "leaderstats"
- local currency = Instance.new("IntValue", folder)
- currency.Name = "Cash"
- currency.Value = ds:GetAsync(plr.UserId) or 0
- currency.Changed:Connect(function()
- ds:SetAsync(plr.UserId, currency.Value)
- end)
- end)
- game.Players.PlayerRemoving:Connect(function(plr)
- ds:SetAsync(plr.UserId, plr.leaderstats.Cash.Value)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement