Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

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

Asked by 1 year 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 5533 — 1y
0
Alternatively, you could use BodyMovers or the PrimaryPart API. ScriptGuider 5533 — 1y
0
ok cool ill try it sean_thecoolman 190 — 1y

1 answer

Log in to vote
0
Answered by 1 year 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 190 — 1y
Ad

Answer this question