Hi i need some help. I posted this yesterday on discord but no one could work it out so i am hoping someone here can. I have two scripts and one teleports you into somewhere and opens a gui to leave there, and the second one when you click the gui, it teleports you out of the place and hides the gui. It works the first time but when you enter, leave and enter again, the gui doesnt appear. Here is the first script, this one teleports you in and opens the gui, It is a normal script:
local tp1 = script.Parent
local tp2 = script.Parent.Parent.Telepart
local db = true
tp1.Touched:Connect(function(hit)
local player = hit.Parent.name
local gui = game.Players:WaitForChild(player).PlayerGui.LeaveTp
if hit.Parent:FindFirstChild("Humanoid")then
if db == true then
db = false
hit.Parent.HumanoidRootPart.CFrame = tp2.CFrame
wait(0.2)
gui.LeaveButton.Visible = true
db = true
end
end
end)
and here is the second script, it teleports you out and makes the gui disappear, It is a local script:
local plr = script.Parent.Parent.Parent.Parent
local char = plr.Character
script.Parent.MouseButton1Click:Connect(function()
char.HumanoidRootPart.CFrame = game.Workspace.LeaveTp.CFrame
script.Parent.Visible = false
end)
If you need any other information, please ask! I think i might just be able to make the gui appear from a remote event but i need your help.

5 comments
I'm happy to help you but this is hard to follow. Can you format this so the script shows up in lua format? Just press the lua code block above the editor!
ok
There, i have updated it
great. could you chat with me in SH chat or discord? I need to discuss the script. Its much easier to debug it that way.
ok discord would be fine