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

Why isnt this Teleport script working?

Asked by 9 years ago

So i want it so when i click this part (the parent of the script) it teleports to the coordinates. im not sure if it just doesnt know what the parent of click is or im doing it wrong completely

local ClickDetector = script.Parent.ClickDetector

ClickDetector.MouseClick:connect(function(click)

    click.Parent:FindFirstChild("Torso")
    click.Parent.CFrame = CFrame.new(-115, 459, 128)


end)

1 answer

Log in to vote
1
Answered by
Voltoxus 248 Moderation Voter
9 years ago

If your trying to move the part its self which is what your making it sound like try:

function onClicked()
script.Parent.CFrame = CFrame.new(Vector3.new(10,10,10))
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

If that's what your trying to accomplish I don't know why you referenced the Torso.

If your trying to move the player then use this:

function onClicked(p)
p.Character:MoveTo(Vector3.new(10,10,10))
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Don't forget to change the Cord's.

0
thanks! I havent mastered MoveTo yet! bubbaman73 143 — 9y
0
Welcome, its a esay to use API for moving the character of a player. Voltoxus 248 — 9y
Ad

Answer this question