Code below, currently it seems very glitchy and unoptimised, anyone got ideas to make it better?
The script is for a car loop, which just goes forward to a tunnel, disappears and then redoes the loop
local OrigCF = script.Parent.CFrame
while true do
while true do
wait(2)
for i = 1,150 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,8) --car goes forward
wait()
end
script.Parent.CFrame = OrigCF
end
end
I would probably start off by not having while true do loops, instead, try having a function that senses when a player is pressing the forward key/button.
The question is unclear, but to my understanding, if you want to make a model travel as a decoration, I suggest using either TweenService service, LinearVelocity constraint, or rig the car to be animate-able and loop the animation so it will run indefinitely.