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

How can I smooth move a model?

Asked by 7 years ago

I have a little airport. I like a airplane to drive or move around there. I tried:

for i = 1,500 do
    Airplane.Position = Airplane.Position + Vector3.new(0,0,5)
    wait(0.01)
end

& a tutorial by Roblox using BodyPosition

But these only works with parts/unions for me. How do I smooth move a whole model?

1
weld it together and then move the main part of the weld (C0) abnotaddable 920 — 7y
0
You can just do wait() instead of wait(0.01) , Also,the less you move it,the smoother it will be. kristibezatlliu1111 33 — 7y

1 answer

Log in to vote
2
Answered by 7 years ago

Use CFrame instead of position, and use the Set/GetPrimaryPartCFrame method available to models:

local speed = 0.05 -- You want a number much lower than 5 studs because you move it 30 times every second!

for i = 1, 500 do
    local currentCFrame = Airplane:GetPrimaryPartCFrame()
    Airplane:SetPrimaryPartCFrame( currentCFrame*CFrame.new(0, 0, speed) )
    wait()
end

The blog has two good articles on what CFrames are and how to use them:

Ad

Answer this question