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

How do I make a model move back and forward?

Asked by 5 years ago

I am trying to make a plane model move back and forward. I searched on the internet on how to move a part and found a script that only moves it forward. Here is the code:

local Model = script.Parent

while wait() do Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(0,0,0 + -2.5)) end

Now how do i move it in the opposite direction after a few seconds?

1 answer

Log in to vote
0
Answered by
zuup123 99
5 years ago
local  Model = script.Parent

while wait() do
Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(0,0,0 + -2.5)) 
wait(5) -- wait
Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(0,0,0 + 2.5))  --do the same but in opposite direction
end

If you wanna make it move in cetrain direction multiple times use for loop.

Ad

Answer this question