Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local DataStore = DataStoreService:GetDataStore("MoneyStats") -- Change this with a different name.
- game.Players.PlayerAdded:Connect(function(Player)
- local Leaderstats = Instance.new("Folder", Player)
- Leaderstats.Name = "leaderstats"
- local Cash= Instance.new("IntValue", Leaderstats)
- Cash.Name = "Cash"
- Cash.Value = 100
- local Rebirths= Instance.new("IntValue", Leaderstats)
- Rebirths.Name = "Rebirths" -- Change "Rebirths" with your currency.
- Rebirths.Value = 0
- local Data = DataStore:GetAsync(Player.UserId)
- if Data then
- Cash.Value = Data.Cash -- Change "Money" with your currency.
- Rebirths.Value = Data.Rebirths -- Change "Rebirths" with your currency.
- end
- end)
- game.Players.PlayerRemoving:Connect(function(Player)
- DataStore:SetAsync(Player.UserId, {
- ["Cash"] = Player.leaderstats.Cash.Value; -- Change "Money" with your currency.
- ["Rebirths"] = Player.leaderstats.Rebirths.Value; -- Change "Rebirths" with your currency.
- })
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement