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 random name.
- game.Players.PlayerAdded:Connect(function(Player)
- local Leaderstats = Instance.new("Folder")
- Leaderstats.Name = "leaderstats"
- Leaderstats.Parent = Player
- local Currency = Instance.new("StringValue")
- Currency.Name = "Money" -- Change this with your currency name.
- Currency.Value = DataStore:GetAsync(Player.UserId) or "0"
- Currency.Parent = Leaderstats
- end)
- game.Players.PlayerRemoving:Connect(function(Player)
- DataStore:SetAsync(Player.UserId, Player.leaderstats.Money.Value)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement