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

How would i use MoveTo?

Asked by 8 years ago

I've seen this in a lot of minigame scripts. I've used

script.Parent.Touched:connect(function(at)
         at:MoveTo(script.Parent.Position)
end)

but for some reason errors.. can anywone help?

0
Btw im trying to make the at variable teleport to the other side of the map. digitalzer3 123 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
script.Parent.Touched:connect(function(at)
    at.Parent:FindFirstChild("Humanoid"):MoveTo(script.Parent.Position)
end)

you have to find the Humanoid of the player that you want to move because MoveTo is in you players Humanoid.

if you want the player to keep on following the part for ever then

script.Parent.Touched:connect(function(at)
    while true do
    at.Parent:FindFirstChild("Humanoid"):MoveTo(script.Parent.Position)
wait()
end
end)
Ad

Answer this question