I am trying to make an elevator that teleports everyone that is touching the inside of the elevator to the top floor. Once a button to close the door has been pressed then everyone touching that brick is teleported. I haven't been able to get it all to work and I need some help on this.
local Teleport = "Teleporter2"
local time = 2 -- change to change cooldown
function Touch(hit)
wait (5)
debounce = true
local Pos = script.Parent.Parent:findFirstChild(Teleport)
hit.Parent:moveTo(Pos.Position)
wait(time)
debounce = false
end
script.Parent.ClickDetector.MouseClick:Connect(Touch)
