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?
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)