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 make a model move back and forward?

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

✓ Accepted answer
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.

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