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

Why doesn't my teleport script work?

I'm trying to make this script work by click the button teleporting the player to the second brick name "Teleporter1". Any suggestions?

local Player = game.Players.LocalPlayer --// Will only work in a LocalScript
local Character = Player.Character

function onClick()
	if Character == nil and Character:FindFirstChild("Torso") then
        Character.Torso.CFrame = script.Parent.Teleporter1.CFrame + Vector3.new(0, 10, 0)
	  end
	end
script.Parent.ClickDetector.MouseClick:connect(onClick)

1 comment

0

Use MoveTo:

2 answers

✓ Accepted answer
TP = workspace["THEPARTYOUWANTTOTELEPORTTO"]

function onClicked()

local c = game.Players:GetChildren() 
for i = 1, #c do 
c[i].Character:MoveTo(TP.Position) 
end 

end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Replace + Vector3.new(0, 10, 0) with * CFrame.new(0, 10, 0) Also replace Character == nil with Character ~= nil

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