Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// local variables
- local DataStore = game:GetService("DataStoreService")
- local save1 = DataStore:GetDataStore("CashSave")
- -- PlayerAdded Event Function
- game.Players.PlayerAdded:connect(function(player)
- local cash = player:WaitForChild("leaderstats").Cash
- cash.Value = save1:GetAsync(player.UserId) or 0
- save1:SetAsync(player.UserId, cash.Value)
- --// Changed Event Function
- cash.Changed:connect(function()
- save1:SetAsync(player.UserId, cash.Value)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement