Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TeleportService = game:GetService("TeleportService")
- local dVersion = 1
- local SaveWins = game:GetService("DataStoreService"):GetOrderedDataStore("Wins", dVersion)
- local VIPGamepass = 94862586
- game.Players.PlayerAdded:Connect(function(player)
- local previousData = SaveWins:GetAsync(player.UserId)
- local Wins
- if previousData ~= nil then
- Wins = previousData
- else
- Wins = 0
- SaveWins:SetAsync(player.UserId, 0)
- end
- local WinsValue = Instance.new("NumberValue", player)
- WinsValue.Name = "Wins"
- WinsValue.Value = Wins
- end)
- game:BindToClose(function()
- for i, player in pairs(game.Players:GetPlayers()) do
- local Value = player.Wins.Value
- SaveWins:SetAsync(player.UserId, Value)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local Value = player.Wins.Value
- if Value ~= nil then
- print("Found data to save for "..player.Name.."!")
- SaveWins:SetAsync(player.UserId, Value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
- local SaveRounds = game:GetService("DataStoreService"):GetOrderedDataStore("Rounds", dVersion)
- game.Players.PlayerAdded:Connect(function(player)
- local previousData = SaveWins:GetAsync(player.UserId)
- local Rounds
- if previousData ~= nil then
- Rounds = previousData
- else
- Rounds = 0
- SaveRounds:SetAsync(player.UserId, 0)
- end
- local RoundsValue = Instance.new("NumberValue", player)
- RoundsValue.Name = "Rounds"
- RoundsValue.Value = Rounds
- end)
- game:BindToClose(function()
- for i, player in pairs(game.Players:GetPlayers()) do
- local Value = player.Rounds.Value
- SaveRounds:SetAsync(player.UserId, Value)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local Value = player.Rounds.Value
- if Value ~= nil then
- print("Found data to save for "..player.Name.."!")
- SaveRounds:SetAsync(player.UserId, Value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
- local SaveLives = game:GetService("DataStoreService"):GetOrderedDataStore("Lives", dVersion)
- game.Players.PlayerAdded:Connect(function(player)
- local previousData = SaveWins:GetAsync(player.UserId)
- local Lives
- if previousData ~= nil then
- Lives = previousData
- else
- Lives = 0
- SaveLives:SetAsync(player.UserId, 0)
- end
- local LivesValue = Instance.new("NumberValue", player)
- LivesValue.Name = "Lives"
- LivesValue.Value = Lives
- end)
- game:BindToClose(function()
- for i, player in pairs(game.Players:GetPlayers()) do
- local Value = player.Lives.Value
- SaveLives:SetAsync(player.UserId, Value)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local Value = player.Lives.Value
- if Value ~= nil then
- print("Found data to save for "..player.Name.."!")
- SaveLives:SetAsync(player.UserId, Value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
- local SaveCoins = game:GetService("DataStoreService"):GetOrderedDataStore("Coins", dVersion)
- game.Players.PlayerAdded:Connect(function(player)
- local previousData = SaveWins:GetAsync(player.UserId)
- local Coins
- if previousData ~= nil then
- Coins = previousData
- else
- Coins = 0
- SaveCoins:SetAsync(player.UserId, 0)
- end
- local CoinsValue = Instance.new("NumberValue", player)
- CoinsValue.Name = "Coins"
- CoinsValue.Value = Coins
- if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, VIPGamepass) then
- player.Coins.Value = player.Coins.Value *2
- end
- end)
- game:BindToClose(function()
- for i, player in pairs(game.Players:GetPlayers()) do
- local Value = player.Coins.Value
- SaveCoins:SetAsync(player.UserId, Value)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local Value = player.Coins.Value
- if Value ~= nil then
- print("Found data to save for "..player.Name.."!")
- SaveCoins:SetAsync(player.UserId, Value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
- local SaveGems = game:GetService("DataStoreService"):GetOrderedDataStore("Gems", dVersion)
- game.Players.PlayerAdded:Connect(function(player)
- local previousData = SaveGems:GetAsync(player.UserId)
- local Gems
- if previousData ~= nil then
- Gems = previousData
- else
- Gems = 0
- SaveGems:SetAsync(player.UserId, 0)
- end
- local GemsValue = Instance.new("NumberValue", player)
- GemsValue.Name = "Gems"
- GemsValue.Value = Gems
- if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, VIPGamepass) then
- player.Gems.Value = player.Gems.Value *2
- end
- end)
- game:BindToClose(function()
- for i, player in pairs(game.Players:GetPlayers()) do
- local Value = player.Gems.Value
- SaveGems:SetAsync(player.UserId, Value)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local Value = player.Gems.Value
- if Value ~= nil then
- print("Found data to save for "..player.Name.."!")
- SaveGems:SetAsync(player.UserId, Value)
- print("Saved data for "..player.Name)
- else
- print("Did not manage to find data to save for "..player.Name.."!")
- end
- end)
- local TeleportData = TeleportService:GetLocalPlayerTeleportData()
- if TeleportData then
- local player = game.Players:GetPlayerByUserId(TeleportData.PlayerName)
- player:WaitForChild("Wins").Value = player:WaitForChild("Wins").Value + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement