local TweenService = game:GetService("TweenService") local MarketplaceService = game:GetService("MarketplaceService") local TeleportService = game:GetService("TeleportService") local player = game.Players.LocalPlayer -- THIS ARE THE REMOTES YOU NEED TO HAVE INSIDE REPLICATED STORAGE local diedEvent = game.ReplicatedStorage.DiedEvent local reviveEvent = game.ReplicatedStorage.reviveEvent local boughtLifeEvent = game.ReplicatedStorage.boughtLifeEvent -- local ScreenGui = player.PlayerGui.DeathScreen local extra_life = false local LobbyId = 14705679998 local ProductId = 1773114333 local function teleportToLobby() TeleportService:Teleport(LobbyId) -- change to lobby ID end local function startTimer() local timer = 30 repeat timer = timer - 1 ScreenGui.DeathFrame.DiedFrame.Time.Text = "Teleporting In "..timer.." Seconds" wait(1) until timer <= 0 or extra_life == true if extra_life == true then reviveEvent:FireServer() ScreenGui.DeathFrame.Visible = false else teleportToLobby() end end boughtLifeEvent.OnClientEvent:Connect(function() extra_life = true end) ScreenGui.DeathFrame.DiedFrame.Continue.MouseButton1Down:connect(function() if player.Coins.Value >= 100 then player.Coins.Value = player.Coins.Value - 100 reviveEvent:FireServer(player) elseif player.Money.Value >= 25 then player.Money.Value = player.Money.Value - 25 reviveEvent:FireServer(player) else MarketplaceService:PromptProductPurchase(player, ProductId) end end) diedEvent.OnClientEvent:Connect(function() ScreenGui.DeathFrame.Visible = true startTimer() end) player:WaitForChild("Coins").Changed:Connect(function(Value) ScreenGui.DeathFrame.DiedFrame.CoinsAmount.Text = "You Have: "..Value end) ScreenGui.DeathFrame.DiedFrame.CoinsAmount.Text = "You Have: "..player.Coins.Value.." (Coins)" player:WaitForChild("Money").Changed:Connect(function(Value) ScreenGui.DeathFrame.DiedFrame.CashAmount.Text = "You Have: "..Value end) ScreenGui.DeathFrame.DiedFrame.CashAmount.Text = "You Have: "..player.Money.Value.." (Cash)"