More realistic approach to tank controls

the way control works, is it too quickly gains speed (not realistic for tank game), and stays like that till you drive off a hill and gain even more speed.

is there anyway to fix/optimize my code, to make it work the way how irl tank engines work, gaining speed slowly till defined max speed?

uis.InputBegan:Connect(function(input, processed)
	if processed then return end
	if not seat then return end
	if not seat:IsA("VehicleSeat") then return end
	if seat.Occupant ~= humanoid then return end
	
	local attributes = vehicle:GetAttributes()
	
	if input.KeyCode == Enum.KeyCode.W then
		while uis:IsKeyDown(Enum.KeyCode.W) do
			chassis:ApplyImpulse(chassis.CFrame.LookVector * -seat.Throttle * attributes.ForwardPower)

			task.wait()
		end
	end

	if input.KeyCode == Enum.KeyCode.S then
		while uis:IsKeyDown(Enum.KeyCode.S) do
			chassis:ApplyImpulse(chassis.CFrame.LookVector * seat.Throttle * -attributes.BackwardPower)

			task.wait()
		end
	end

	if input.KeyCode == Enum.KeyCode.D then
		while uis:IsKeyDown(Enum.KeyCode.D) do
			chassis:ApplyAngularImpulse(Vector3.new(0, -attributes.SteerPower * seat.Steer, 0))

			task.wait()
		end
	end

	if input.KeyCode == Enum.KeyCode.A then
		while uis:IsKeyDown(Enum.KeyCode.A) do
			chassis:ApplyAngularImpulse(Vector3.new(0, attributes.SteerPower * -seat.Steer, 0))

			task.wait()
		end
	end
end)

Can’t you just decrease forward/backward power?

it would decrease max speed and speed itself

I believe it would be best to directly use physics along with a HingeConstraint motor. You can simplify the tank collisions to be 3 or 4 wheels on each side. Then just hide the wheels, and have the tracks rotate to give an illusion that the tracks move.

You should use springs for the wheels. But basically a car with more wheels. You should be able to find plenty of resources for a car. You can probably use A-chassis and modify it to suit your needs.

I don’t use hinge constraints, instead I use raycast suspension