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

Why doesn't my teleport script work?

Asked by 9 years ago

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)
0
Use MoveTo: iNicklas 215 — 9y

2 answers

Log in to vote
0
Answered by
iNicklas 215 Moderation Voter
9 years ago
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)
Ad
Log in to vote
1
Answered by
funyun 958 Moderation Voter
9 years ago

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

Answer this question