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

Teleport Script is not working? so i got a book and all scripts were working but not this

Asked by
tttvbb 2
3 years ago
Edited 3 years ago

Teleport Script

Teleport Script: ``

 local Teleport1A = script.Parent
 local Teleport1B = script.Parent.Teleport1B

local canTeleport = true
function Teleport1A(part)
    local hum = part.Parent:FindFirstChild("HumanoidRootPart")
    if hum then
        if canTeleport then
            canTeleport = false
            hum.CFrame = Teleport1B.CFrame + Vector3.new(0,5,0)
                wait(5)
            canTeleport = true
        end
    end 
 end

 function Teleport1B(part)
    local hum = part.Parent:FindFirstChild("HumanoidRootPart")
    if hum then
        if canTeleport then
            canTeleport = false
            hum.CFrame = Teleport1A.CFrame + Vector3.new(0,5,0)
            wait(5)
            canTeleport = true
        end
    end
 end


Teleport1A.Touched:connect(Teleport1A)
Teleport1B.Touched:connect(Teleport1B)

`> `

Teleport1A.Touched:connect(Teleport1A) Teleport1B.Touched:connect(Teleport1B)

>

1 answer

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

Well, I would like you to use MoveTo instead of Vector3. If the script doesn't work, double check the directories of the part and then also not working, try changing the name of both the functions.

 local Teleport1A = script.Parent
 local Teleport1B = script.Parent.Teleport1B

local canTeleport = true
function Teleport1A(part)
    local hum = part.Parent
    if hum then
        if canTeleport then
            canTeleport = false
            hum:MoveTo(Teleport1B.Position) -- Moves the player's position to Teleport1B's position
                wait(5)
            canTeleport = true
        end
    end 
 end

 function Teleport1B(part)
    local hum = part.Parent
    if hum then
        if canTeleport then
            canTeleport = false
            hum:MoveTo(Teleport1A.Position)
            wait(5)
            canTeleport = true
        end
    end
 end


Teleport1A.Touched:Connect(Teleport1A) -- Capital 'C'
Teleport1B.Touched:Connect(Teleport1B) -- Capital 'C'

Lemme know if it helps!

0
If Teleport1A and Teleport1B is a model, use hum:MoveTo(Teleport1A.PrimaryPart.Position) and then go to explorer, select the model and go to properties. Then, click on PrimaryPart and then on explorer, click the part taht is the centre of the model. BestCreativeBoy 1395 — 3y
0
oh.. model! Newh0hrizonCz 58 — 3y
0
WHATS directories? tttvbb 2 — 3y
0
Directories here means where the part is located in explorer BestCreativeBoy 1395 — 3y
View all comments (15 more)
0
and the name of the functions and the name of the parts BestCreativeBoy 1395 — 3y
0
If it still doesn't work, DM me in discord Samyak#7649 BestCreativeBoy 1395 — 3y
0
local Teleport = "Part2" function Touch(hit) if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true local Pos = script.Parent.Parent:findFirstChild(Teleport) hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFi PandaFaminto0202 -6 — 3y
0
how to check directories? tttvbb 2 — 3y
0
Do you have discord? BestCreativeBoy 1395 — 3y
0
Or can you add Team Create o that I can see what the real issue is BestCreativeBoy 1395 — 3y
0
yeah i have discord tttvbb 2 — 3y
0
and its a test game not an actual game tttvbb 2 — 3y
0
i made it team create. what do i do next? tttvbb 2 — 3y
0
Samyak#7649 is my discord DM me there BestCreativeBoy 1395 — 3y
0
It will be easier for me to provide help to you in realtime BestCreativeBoy 1395 — 3y
0
ok at 6:00 pm IST tttvbb 2 — 3y
0
i reqested you on discord tttvbb 2 — 3y
0
https://discord.gg/xvbctS for @BestCreativeBoy  tttvbb 2 — 3y
Ad

Answer this question