Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.