local seat = script.Parent
local LeftDrive = seat.Parent.FrontAxle.LeftDrive
local RightDrive = seat.Parent.FrontAxle2.RightDrive
local SteerHinge = seat.Parent.FrontAxle.SteerHinge
local SteerHinge2 = seat.Parent.FrontAxle2.SteerHinge2
local SteerAngle = 30
local MaxSpeed = 160
local Reverse = 40
local Foward = 160
 
local function OnChanged(property)
	if property == "Steer" then
		SteerHinge.TargetAngle = SteerAngle * seat.Steer
		SteerHinge2.TargetAngle = SteerAngle * seat.Steer
	end
	if property == "Throttle" then
		LeftDrive.AngularVelocity = MaxSpeed * seat.Throttle
		RightDrive.AngularVelocity = MaxSpeed * seat.Throttle
	end
end

seat.Changed:connect(OnChanged)

if seat.ThrottleFloat == -1 then
	MaxSpeed = Reverse
end

if seat.ThrottleFloat == 1 then
	MaxSpeed = Foward
end

In this script, i want to make a set speed for the car when it moves backward or foward. The above script didnt work, pls fix it for me! Thx !

2 comments

0

You'll probably need to be a bit more specific that "it doesn't work".

0

the speed limit doesnt work. i forgot to say it