Hello, I'm trying to script a teleporting block which has a timer
Explanation: When stepped on the block, it takes 4 seconds to teleport to the other teleporter.
EDIT: When someone steps on the block, and 2 seconds after someone else steps on it, then both you and he teleport to the other block at the same time
Simple explanation, if you need any more information then tell me. Any help is appreciated :)
Even though your question is more on the request side, I made a teleport script for you. This might not do exactly what you want, because your wording is a bit confusing.
function teleport(player) local HumanoidRootPart = player.HumanoidRootPart HumanoidRootPart.CFrame = CFrame.new(script.Parent.Parent.Second.Position) end script.Parent.Touched:connect(function(tele) wait(4) teleport(tele.Parent) end)
Once a player steps on the pad, it will wait 4 seconds before the teleport. To make this script work, create two parts, one named First and the other named Second. Make sure you capitalize the first letters. Put this script in "First" and group "First" and "Second" together. Note: This will only work one way. To make it work both ways, but this same script in "Second" but change line 3 to
HumanoidRootPart.CFrame = CFrame.new(script.Parent.Parent.First.Position)
I hope this helps. [EDIT] Also, to add a sound when the pad is touched, insert your sound into the pad model and name it Sound. Again, make sure it is capitalized. On the script, go to line 3, hit enter to make a new line, and add this:
script.Parent.Sound:Play()
If you want to broadcast who stepped on the pad, add this too:
print(tele.Parent, " has touched teleport pads")
To see those messages, hit F9 to open the dev console and go to server. The message will be broadcasted by a script so it should be on the server side.