well this is the basic of how i did it in my car game (obviously it wont work as is because there's more code in my script)
first you define the top speed, acceleration etc
speed[e] = 0
top_speed[e] = 2000
accel[e] = 100
reverse_speed[e] = 300
player = e
then in the main script you just check update the speed based on the player holding w or s (my turning is done via the mouse)
--player presses w to accelerate
if g_KeyPressW == 1 then
if speed[e] + accel[e] <= top_speed[e] then
speed[e] = speed[e] + accel[e]
elseif speed[e] < top_speed[e] then
speed[e] = top_speed[e]
end
--player presses s to brake
elseif g_KeyPressS == 1 then
if speed[e] - accel[e] >= -reverse_speed[e] then
speed[e] = speed[e] - accel[e]
elseif speed[e] > -reverse_speed[e] then
speed[e] = -reverse_speed[e]
end
else
if speed[e] - (accel[e]/2) >= 0 then
speed[e] = speed[e] - (accel[e]/2)
elseif speed[e] > 0 then
speed[e] = 0
end
if speed[e] + (reverse_speed[e]/2) <= 0 then
speed[e] = speed[e] + (reverse_speed[e]/2)
elseif speed[e] < 0 then
speed[e] = 0
end
end
SetRotation(e,0,g_PlayerAngY,0)
MoveForward(e,speed[e])
TransportToIfUsed(e)