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

How do I move a model by using a for loop?

Asked by 5 years ago

Code I have so far:

for i = 0.0001,10*100e+999 do 
            game.Workspace.Rocket:MoveTo(38, 67.171+i, -168.25)
            wait(0.01)
        end

Trying to use the loop above would give me an error that goes like:

Unable to cast double Vector3

What am I doing wrong and how do I fix it?

0
Please never abuse a for loop like that again. You should either use TweenService, or check out a video I made on tweening: https://www.youtube.com/watch?v=tZdrtccA11c&t=211s ScriptGuider 5640 — 5y
0
Alternatively, you could use BodyMovers or the PrimaryPart API. ScriptGuider 5640 — 5y
0
ok cool ill try it sean_thecoolman 189 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You're supposed to input a Vector3 and not three seperate values.

for i = 0.0001,10*100e+999 do 
            game.Workspace.Rocket:MoveTo(Vector3.new(38, 67.171+i, -168.25))
            wait(0.01)
        end
0
ohhh ok thanks sean_thecoolman 189 — 5y
Ad

Answer this question