Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --script made by the crispydevvv
- local dsService = game:GetService("DataStoreService")
- local ds = dsService:GetDataStore("CoinStats") --rename 'coinstats' to whatever you want that doesnt affect the script!
- game.Players.PlayerAdded:Connect(function(plr)
- local folder = Instance.new("Folder", plr)
- folder.Name = "leaderstats"
- local currency = Instance.new("IntValue", folder)
- currency.Name = "Coins" --change 'coins' to your currency name
- 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.Coins.Value) --also change 'coins' to your currency value
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement