Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Any way of making a Teleport brick that will teleport a player to another brick?

Asked by 2 years ago
Edited 2 years ago

Any way of making a teleport brick that will teleport you to another brick?

E.G Let's say I have a brick named 'Brick1' then it should teleport it to 'Brick2',BUT Brick2 should not teleport the player back to Brick1.

Any stuff to edit here?

Brick1:

local Teleport = "Brick2"
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:findFirstChild(Teleport).Locked = false end end
script.Parent.Touched:connect(Touch)


Brick2:

local Teleport = "Brick1"
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:findFirstChild(Teleport).Locked = false end end
script.Parent.Touched:connect(Touch)

Any help would be appreciated!

Thanks, Best of Regards, Gru

2 answers

Log in to vote
0
Answered by 2 years ago

These scripts are a bit weird? For the thing you want you need to bricks located in the workspace

Only the first part needs a script:

brick = script.Parent
brick2 = workspace.brick2 -- change this to your second brick's name (like workspace.BRICKTOTELEPORTTONAME)

brick.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.HumanoidRootPart.CFrame = brick2.CFrame
    end
end)

and a second part to teleport to (named brick2 or edit the code if it isn't named brick2)

Ad
Log in to vote
-1
Answered by
ko_oky -3
2 years ago

game:Destroy()

Answer this question