Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a teleport block with a timer?

Asked by 5 years ago
Edited 5 years ago

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

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

0
You probably want to add a debounce to that :) ForeverBrown 356 — 5y
0
In the teleporter I originally used this in the bounce wasn't that bad, so I didn't add it. He can add it if he wants though. one23four56 20 — 5y
0
How can I make the block play a sound when walked on it (only I am able to hear the sound) on the same block with the teleporter? oliwierpl11alt 20 — 5y
0
I added that in to the answer. one23four56 20 — 5y
View all comments (6 more)
0
Thanks once again for replying. When I walked on the block it teleported me to the second block after 4 seconds, but it could not let me leave! Is there any possible fix for that? oliwierpl11alt 20 — 5y
0
That is a glitch, to fix it (make sure you have a part under the second teleport pad with CanCollide on) and anchor the second part, also turn CanCollide off for it. one23four56 20 — 5y
0
Also sorry for the late response I was busy. one23four56 20 — 5y
0
I don't mind how long it takes to respond, I'm glad that you're helping me. oliwierpl11alt 20 — 5y
0
Also, when teleported to the "Second" part, it teleports you back to the "First" part and it loops like that and you can't stop it. Know how to fix it? Like adding a delay to the teleporters? oliwierpl11alt 20 — 5y
0
by delay, I mean that you either have to wait (number) seconds or you have to walk off the block and then you'll be able to teleport again. I know that I'm demanding much, sorry 'bout that. oliwierpl11alt 20 — 5y
Ad

Answer this question