local TeleportService = game:GetService("TeleportService") local SaveCurrency3 = game:GetService("DataStoreService"):GetDataStore("Coins") local SaveExtraLives = game:GetService("DataStoreService"):GetDataStore("Lives") local SaveRoleData = game:GetService("DataStoreService"):GetDataStore("Role") local SaveAddRounds = game:GetService("DataStoreService"):GetDataStore("AddRounds") local SaveAddWins = game:GetService("DataStoreService"):GetDataStore("AddWins") local VIPGamepassId = "265392817" game.Players.PlayerAdded:Connect(function(player) if game.ReplicatedStorage.Tags.Leaderstats.Value == true then local Folder = Instance.new("Folder",player) Folder.Name = "leaderstats" local AddRounds = Instance.new("NumberValue", player) AddRounds.Name = "AddRounds" AddRounds.Value = SaveAddRounds:GetAsync(player.UserId) or 0 local AddWins = Instance.new("NumberValue", player) AddWins.Name = "AddWins" AddWins.Value = SaveAddWins:GetAsync(player.UserId) or 0 local previousData = SaveCurrency3:GetAsync(player.UserId) local Coins if previousData ~= nil then Coins = previousData else Coins = 0 SaveCurrency3:SetAsync(player.UserId, 0) end local CoinsValue = Instance.new("NumberValue", player) CoinsValue.Name = "Coins" CoinsValue.Value = Coins local val1 = Instance.new("StringValue",player) val1.Name = 'GotPet' val1.Value = '' local val2 = Instance.new("StringValue",player) val2.Name = 'OpenValue' val2.Value = '' local previousData2 = SaveExtraLives:GetAsync(player.UserId) local Lives local previousData3 = SaveRoleData:GetAsync(player.UserId) local Role if previousData2 ~= nil then Lives = previousData2 else Lives = 0 SaveExtraLives:SetAsync(player.UserId, 0) end if previousData3 ~= nil then Role = previousData3 else Role = player.Role.Value SaveRoleData:SetAsync(player.UserId, player.Role.Value) end local ExtraLivesValue = Instance.new("NumberValue", player) ExtraLivesValue.Name = "Lives" ExtraLivesValue.Value = Lives local RoleValue = Instance.new("StringValue", player) RoleValue.Name = "Role" RoleValue.Value = Role if player:WaitForChild("Role").Value >= "Normal Kid" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 0.7 player.Character.Humanoid.BodyHeightScale.Value = 0.7 player.Character.Humanoid.BodyWidthScale.Value = 0.6 elseif player:WaitForChild("Role").Value >= "Protector 1" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "Medic" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "Fighter" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 0.7 player.Character.Humanoid.BodyHeightScale.Value = 0.7 player.Character.Humanoid.BodyWidthScale.Value = 0.6 elseif player:WaitForChild("Role").Value >= "Protector 3" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "PREMIUM" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "Default Kid" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "Adventure" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 elseif player:WaitForChild("Role").Value >= "Fat Kid" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 0.9 player.Character.Humanoid.BodyHeightScale.Value = 0.7 player.Character.Humanoid.BodyWidthScale.Value = 0.7 elseif player:WaitForChild("Role").Value >= "Golden Protector" then player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.BodyDepthScale.Value = 1 player.Character.Humanoid.BodyHeightScale.Value = 1 player.Character.Humanoid.BodyWidthScale.Value = 1 end if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, VIPGamepassId) then player.Coins.Value = player.Coins.Value * 2 end end end) game:BindToClose(function() print("STOPPED!") for i,player in pairs(game.Players:GetPlayers()) do local value = player.Coins.Value SaveCurrency3:SetAsync(player.UserId, value) print("Saved data for "..player.Name) 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.."!") SaveCurrency3: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) game:BindToClose(function() print("STOPPED!") for i, player in pairs(game.Players:GetPlayers()) do local value2 = player.Lives.Value SaveExtraLives:SetAsync(player.UserId, value2) end end) game.Players.PlayerRemoving:Connect(function(player) local value2 = player.Lives.Value if value2 ~= nil then print("Found data to save for "..player.Name.."!") SaveExtraLives:SetAsync(player.UserId, value2) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end) game:BindToClose(function() print("STOPPED!") for i, player in pairs(game.Players:GetPlayers()) do local value3 = player.Role.Value SaveRoleData:SetAsync(player.UserId, value3) end end) game.Players.PlayerRemoving:Connect(function(player) local value3 = player.Role.Value if value3 ~= nil then print("Found data to save for "..player.Name.."!") SaveRoleData:SetAsync(player.UserId, value3) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end) game:BindToClose(function() print("STOPPED!") for i, player in pairs(game.Players:GetPlayers()) do local AddRoundsValue = player.AddRounds.Value SaveAddWins:SetAsync(player.UserId, AddRoundsValue) end end) game.Players.PlayerRemoving:Connect(function(player) local AddRoundsValue = player.AddRounds.Value if AddRoundsValue ~= nil then print("Found data to save for "..player.Name.."!") SaveAddRounds:SetAsync(player.UserId, AddRoundsValue) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end) game:BindToClose(function() print("STOPPED!") for i, player in pairs(game.Players:GetPlayers()) do local AddWinsValue = player.AddWins.Value SaveAddWins:SetAsync(player.UserId, AddWinsValue) end end) game.Players.PlayerRemoving:Connect(function(player) local AddWinsValue = player.AddWins.Value if AddWinsValue ~= nil then print("Found data to save for "..player.Name.."!") SaveAddWins:SetAsync(player.UserId, AddWinsValue) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end) game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) char.Humanoid.Died:connect(function() SaveAddRounds:SetAsync(player.UserId, player.AddRounds.Value) SaveExtraLives:SetAsync(player.UserId, player.Lives.Value) player.AddRounds.Value = player.AddRounds.Value + 1 player.Lives.Value = player.Lives.Value - 1 end) end) end)