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

Teleport script doesn't teleport player and work?

Asked by
yoshi8080 445 Moderation Voter
8 years ago

My purpose for this is that I've been trying to make a two way teleport pad. So far, I've made no progress than this so far. No errors, just it doesn't work.

01Debounce = false
02B = script.Parent.Parent.B
03Working = script.Parent.Enabled
04WorkingB = B.Enabled
05 
06script.Parent.Parent.A.Touched:connect(function(Hit)
07 
08if not Debounce and Working == true then
09        Debounce = true
10    Working.Value = false
11        WorkingB.Value = false 
12local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
13local Humanoid = Hit.Parent:FindFirstChild('Humanoid')
14local Character = Player.Character
15local Torso = Character:FindFirstChild('Torso')
View all 70 lines...
0
You should probably combine all of your for i, v statements and see if that helps connor12260311 383 — 8y
0
They are all scanning the pair Character:GetChildren() after all connor12260311 383 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Ok, so I have made a script that you must copy and paste into the part and rename the entrance/exit part and the other entrance/exit part.

This might sound confusing but you will find out what I am saying after reading this....

Here is one of the scripts that needs to go into the original entrance part you will also need to rename the same part to "Door1"

1script.Parent.Touched:connect(function(t)
2        if t.Parent.Humanoid ~= nil then
3 
4                t.Parent.Torso.CFrame = script.Parent.Parent.Door2.CFrame
5 
6        end
7end)

So here I have a script that teleports the player to another part called "Door2" and thats pretty much it, there isnt really anything else to say.

This script needs to be placed in the part that is going to be the exit of the first part aka "Door1".

1script.Parent.Touched:connect(function(t)
2        if t.Parent.Humanoid ~= nil then
3 
4                t.Parent.Torso.CFrame = script.Parent.Parent.Door1.CFrame
5 
6        end
7end)

Basically this script is a return script to Door1, all that is changed is on line 4 from.

this

1t.Parent.Torso.CFrame = script.Parent.Parent.Door2.CFrame

to this.

1t.Parent.Torso.CFrame = script.Parent.Parent.Door1.CFrame

You will also need to rename the part to Door2 and you will be pretty much finished

With saying all that if you have problems with the entrance of the player you might want to change the part's properties to cancolide false.... other than that you should be fine..

If this helped you in any way... please accept this question.

0
I'm pretty sure that isn't the issue, as the error may occur with the debounce section of the script. I'm sure of this, as I have tested this without the debounce and it worked fine, but thanks for taking your time to answer this yoshi8080 445 — 8y
Ad

Answer this question