Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TeleportService = game:GetService("TeleportService")
- local SaveCurrency = game:GetService("DataStoreService"):GetDataStore("Wins")
- local SaveCurrency2 = game:GetService("DataStoreService"):GetDataStore("Plays")
- game.Players.PlayerAdded:Connect(function(player)
- if game.ReplicatedStorage.Tags.Leaderstats.Value == true then
- local Folder = Instance.new("Folder",player)
- Folder.Name = "leaderstats"
- local Currency = Instance.new("NumberValue",Folder)
- Currency.Name = game.ReplicatedStorage.Tags.WinsValue.Value
- Currency.Value = SaveCurrency:GetAsync(player.UserId) or 0
- local Currency2 = Instance.new("NumberValue",Folder)
- Currency2.Name = game.ReplicatedStorage.Tags.PlaysValue.Value
- Currency2.Value = SaveCurrency2:GetAsync(player.UserId) or 0
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- if game.ReplicatedStorage.Tags.Leaderstats.Value == true then
- SaveCurrency:SetAsync(player.UserId,player.leaderstats[game.ReplicatedStorage.Tags.WinsValue.Value].Value)
- SaveCurrency2:SetAsync(player.UserId,player.leaderstats[game.ReplicatedStorage.Tags.PlaysValue.Value].Value)
- end
- end)
- local teleportData = TeleportService:GetLocalPlayerTeleportData()
- if teleportData then
- local Player = game.Players:GetPlayerByUserId(teleportData.PlayerName)
- Player.leaderstats.Wins.Value = Player.leaderstats.Wins.Value + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement