This is the diedEvent:
local function teleportToLobby()
TeleportService:Teleport(8832292226) -- change to lobby ID
end
local function startTimer()
local timer = 15
repeat
timer = timer - 1
ScreenGui.Died.timer.Text = timer
wait(1)
until timer <= 0 or extra_life == true
if extra_life == true then
reviveEvent:FireServer()
ScreenGui.Died.Visible = false
else
teleportToLobby()
end
end
boughtLifeEvent.OnClientEvent:Connect(function()
extra_life = true
end)
ScreenGui.Died.continue.MouseButton1Down:connect(function()
MarketplaceService:PromptProductPurchase(player, 1255419788)-- change to product ID
end)
ScreenGui.Died.btl.MouseButton1Down:connect(function()
teleportToLobby()
end)
diedEvent.OnClientEvent:Connect(function()
ScreenGui.Died.Visible = true
startTimer()
end)
The main thing I want to do is if he have the gamepas, it will cancel the teleporttolobby event, by deleting the script from the other one, the other script (which we have a problem in it):
local Checkifowngamepass = game.ReplicatedStorage.Remotes.CheckIfOwnGamepass
local player = game.Players.LocalPlayer
local ScreenGui = player.PlayerGui.MainGui
local objective = ScreenGui.ObjectiveFrame
local timer = ScreenGui.TimerFrame
local event = player:WaitForChild("diedEvent")
Checkifowngamepass.OnClientEvent:Connect(function()
if objective.Visible == true then
objective.Position = UDim2.new(0, 0, 0.5, 0)
wait(2)
objective:TweenPosition(UDim2.new(-0.5, 0, 0.5, 0))
wait(2)
objective.Visible = false
end
if timer.Visible == true then
timer.Position = UDim2.new(0.5, 0, 0.02, 0)
wait(2)
timer:TweenPosition(UDim2.new(0.5, 0, -0.52, 0))
timer.Visible = false
end
event:Destroy()
repeat wait() until player.PlayerGui.MainGui.Died.Visible == true
player.PlayerGui.MainGui.Died.Visible = false
end)
And yes