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

How would i move a model using vector3 slowly?

Asked by 8 years ago

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

Log in to vote
2
Answered by
k3du53 162
8 years ago

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.

2
I would personally use the lerp function. User#11440 120 — 8y
0
Thanks Supergamerboy1995 129 — 8y
0
Wait no actually it doesn't work? Supergamerboy1995 129 — 8y
0
I set up an opensource place on my alt. https://www.roblox.com/games/166530798/- k3du53 162 — 8y
Ad

Answer this question