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

How would I use MoveTo?/Or fix this MoveTo?

Asked by 9 years ago

I am trying to make a cart move on its own, and I know it uses MoveTo, the Wiki post explains nothing.


while true do wait(math.random(1,4)) for i = -24.6, 29.2, 1 do cart = game.Workspace.Cart cart:MoveTo (10, 4, i) wait(0.001) end end

Did not see any errors, I would like an explanation on how to use MoveTo, and possibly how to fix this. All help is appreciated, thanks!

1 answer

Log in to vote
0
Answered by 9 years ago

:MoveTo requires a Vector3 argument, you are giving three number arguments.

Example: game.Workspace.Model:MoveTo(Vector3.new(10, 4, i))

Also, if you're using a variable that you only need in one function/for do loop/etc. you can use local Name = Value

while true do
    wait(math.random(1,4))
    for i = -24.6, 29.2, 1 do
        local cart = game.Workspace.Cart
        cart:MoveTo(Vector3.new(10, 4, i))
        wait() -- default is the same.
    end
end

Ad

Answer this question