local function R()local R=script.Parent.Values.SteerC.Value if _MSteer then local R=math.max(1,(mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth)/200)local p=_Tune.Peripherals.MSteerDZone/100 local s=(mouse.X-mouse.ViewSizeX/2)/R if math.abs(s)<=p then _GSteerT=0 else _GSteerT=(math.max(math.min(math.abs(s)-p,1-p),0)/(1-p))^_Tune.MSteerExp*(s/math.abs(s))end end if R<_GSteerT then if R<0 then R=math.min(_GSteerT,R+_Tune.ReturnSpeed)else R=math.min(_GSteerT,R+_Tune.SteerSpeed)end else if R>0 then R=math.max(_GSteerT,R-_Tune.ReturnSpeed)else R=math.max(_GSteerT,R-_Tune.SteerSpeed)end end local p=1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-_Tune.MinSteer/100)for s,A in ipairs(car.Wheels:GetChildren())do if A.Name=="\070"then A.Arm.Steer.CFrame=car.Wheels.F.Base.CFrame*CFrame.Angles(0,-math.rad((R*_Tune.SteerInner)*p),0)elseif A.Name=="\070\076"then if R>=0 then A.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad((R*_Tune.SteerOuter)*p),0)else A.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad((R*_Tune.SteerInner)*p),0)end elseif A.Name=="\070\082"then if R>=0 then A.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad((R*_Tune.SteerInner)*p),0)else A.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad((R*_Tune.SteerOuter)*p),0)end end end end
--[[Steering]]

local function Steering()
	local SteerLocal = script.Parent.Values.SteerC.Value
	--Mouse Steer
	if _MSteer then
		local msWidth = math.max(1, mouse.ViewSizeX * _Tune.Peripherals.MSteerWidth / 200)
		local mdZone = _Tune.Peripherals.MSteerDZone / 100
		local mST = ((mouse.X - mouse.ViewSizeX / 2) / msWidth)
		if math.abs(mST) <= mdZone then
			_GSteerT = 0
		else
			_GSteerT = (math.max(math.min((math.abs(mST) - mdZone), (1 - mdZone)), 0) / (1 - mdZone)) ^ _Tune.MSteerExp
				* (mST / math.abs(mST))
		end
	end

	--Interpolate Steering
	if SteerLocal < _GSteerT then
		if SteerLocal < 0 then
			SteerLocal = math.min(_GSteerT, SteerLocal + _Tune.ReturnSpeed)
		else
			SteerLocal = math.min(_GSteerT, SteerLocal + _Tune.SteerSpeed)
		end
	else
		if SteerLocal > 0 then
			SteerLocal = math.max(_GSteerT, SteerLocal - _Tune.ReturnSpeed)
		else
			SteerLocal = math.max(_GSteerT, SteerLocal - _Tune.SteerSpeed)
		end
	end

	--Steer Decay Multiplier
	local sDecay = (1 - math.min(car.DriveSeat.Velocity.Magnitude / _Tune.SteerDecay, 1 - (_Tune.MinSteer / 100)))

	--Apply Steering
	for _, v in ipairs(car.Wheels:GetChildren()) do
		if v.Name == "F" then
			v.Arm.Steer.CFrame = car.Wheels.F.Base.CFrame
				* CFrame.Angles(0, -math.rad(SteerLocal * _Tune.SteerInner * sDecay), 0)
		elseif v.Name == "FL" then
			if SteerLocal >= 0 then
				v.Arm.Steer.CFrame = car.Wheels.FL.Base.CFrame
					* CFrame.Angles(0, -math.rad(SteerLocal * _Tune.SteerOuter * sDecay), 0)
			else
				v.Arm.Steer.CFrame = car.Wheels.FL.Base.CFrame
					* CFrame.Angles(0, -math.rad(SteerLocal * _Tune.SteerInner * sDecay), 0)
			end
		elseif v.Name == "FR" then
			if SteerLocal >= 0 then
				v.Arm.Steer.CFrame = car.Wheels.FR.Base.CFrame
					* CFrame.Angles(0, -math.rad(SteerLocal * _Tune.SteerInner * sDecay), 0)
			else
				v.Arm.Steer.CFrame = car.Wheels.FR.Base.CFrame
					* CFrame.Angles(0, -math.rad(SteerLocal * _Tune.SteerOuter * sDecay), 0)
			end
		end
	end
end
