Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

3 comments

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

0

Alternatively, you could use BodyMovers or the PrimaryPart API.

0

ok cool ill try it

1 answer

✓ Accepted answer

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

1 comment

0

ohhh ok thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.