Hello! I wanted to know how to make a teleport brick that when you click a timer starts. By that i mean like, you click the brick and it teleports you after some seconds. I'm sorry, I'm not that good at scripting and I could not find help anywhere else. It's basically the last thing my game needs and i would really like to make it. Could anyone help me please?
✓ ANSWER ACCEPTED
How do I make it so that when you click a brick there's a timer to teleport you?
1 answer
✓ Accepted answer
Easiest Method:
wait(seconds)
That stops the whole script for that amount of time though. If you need to let the script still do other things in that time, put it in a coroutine like so:
local timer = coroutine.create(function()
wait(seconds)
end)
coroutine.resume(timer)
Edit: Added into your code for example and clarification (3 second timer)
With coroutine:
local tp = game.Workspace.TeleportPart1
script.Parent.MouseClick:Connect(function(plr)
local waitForTp = coroutine.create(function()
wait(3)
plr.Character:MoveTo(tp.Position)
print(plr.Name," has teleported!")
end)
coroutine.resume(waitForTp)
end)
Without coroutine:
local tp = game.Workspace.TeleportPart1
script.Parent.MouseClick:Connect(function(plr)
wait(3)
plr.Character:MoveTo(tp.Position)
print(plr.Name," has teleported!")
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
So, if i was using this script: local tp = game.Workspace.TeleportPart1 script.Parent.MouseClick:Connect(function(plr) plr.Character:MoveTo(tp.Position) print(plr.Name," has teleported!") end) where would i put this? Also, thanks for answering!
you connect Mouseclick to a function creating the coroutine and starting it. After the wait() inside the coroutine you teleport the player. I am going to edit the answer and import it into your code.
Alright, thank you so much!