Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to teleport and close GUI at the same time?

Here is what I am working with. I am trying to combine these two scripts. It teleports, but it does not close the GUI after the teleport is complete.

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function helpme()
 if not debounce then
  
 debounce = true
 LowerTorso = player.Character.LowerTorso
 LowerTorso.CFrame = game.Workspace.mainfloor.CFrame
 
 end
end
button.MouseButton1Click:connect(helpme)

while true do wait()
debounce = false
wait(7.5)
end

script.Parent.MouseButton1Click:connect(function()
	script.Parent.Parent.Parent:Destroy()
end)

1 answer

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
character:MoveTo()--Teleport player
script.Parent.Parent.Parent:Destroy()

just make it simply not difficult.

This discussion is preserved as it was. New answers, comments, and votes are closed.