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

How would i move a model using vector3 slowly?

So here i have the script to move my model to a position...

thing = workspace.Tornado
thing:MoveTo(Vector3.new(0,0,0))

...But how can i make it so it "floats" or "glides" to that position, rather than just teleport to that position?

1 answer

Your best bet would be to use a For loop.

For example,

for i = 1, 20 do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.new(.2, 0, 0)
	wait()
end

This, in a script parented to the part, will move the parent brick 1/5 of a stud every ~1/30th of a second, 20 times. Thus, moving the part 8 studs.

If you're looking to only use Vector3 values, here is another example.

for i = 1, 20 do
	script.Parent.Position = script.Parent.Position + Vector3.new(.2, 0, 0)
	wait()
end

Same script.

Hopefully my overuse of examples explains this well.

4 comments

2

I would personally use the lerp function.

0

Thanks

0

Wait no actually it doesn't work?

0

I set up an opensource place on my alt. https://www.roblox.com/games/166530798/-

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