Trouble with car when I change throttle in a loop

I want to achieve a self driving car, I have fixed the collision system but not the self driving.

I just want to make it go straight so I tried this:

while true do
workspace.Van.Drive.Throttle = 1

But that makes the car “stutter”. Look:

I also tried to change throttle when the property changes in the Drive Seat but it still dosen’t work.

I am using NWSpacek’s Transporter Van just to test with.

What movement are you trying to achieve? If you want it to go at a constant speed shouldn’t you be able to remove the while loop portion?

(I haven’t done much with vehicles so I may be wrong…)

Edit: You probably want to use something other than throttle.

Try binding it to heartbeat:

local RunService = game:GetService("RunService")
while true do
    workspace.Van.Drive.Throttle = 1

The stuttering is caused by the wait(). The throttle goes to 1 and then decreases to 0 during the wait(). You either want to find a property that sets a constant velocity or remove wait(), possibly through the really short heatbeat timing like @mobyboyy said (still might cause some stutter though).

Do you know a property which is responsible for a constant velocity?

Currently, I am thinking you could probably hack something together by setting “max-speed” to the velocity you want and then in your while loop set throttle to something really high (50 maybe?).

(Just take my advice with a grain of salt as I haven’t worked much with vehicles)

Alright, I can try doing that.