function Steering()local N=0 local F=tick()local O=0 local l=0 local W=3 local I=.3 local V=0 local U=0 local R=1 local X=math.rad(34)local B=math.rad(37)local d=math.rad(1)local S=math.rad(1)local r=.25 local e=400 local Z=2 local i=.7 local s=350 local c=1.65 local u=50 local o=2 local Q=.1 local function D()local N=X local F=B local O=d local l=S if V<0 then N=B F=X O=S l=d end for F,O in pairs(car.Wheels.FL:GetChildren())do O.Arm.Steer.cframe=O.Base.CFrame*CFrame.Angles(0,V*-N,0)local l=(O.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector O.Arm.Steer.MaxTorque=Vector3.new(math.abs(l.x),math.abs(l.y),math.abs(l.z))*50000 end for N,O in pairs(car.Wheels.FR:GetChildren())do O.Arm.Steer.cframe=O.Base.CFrame*CFrame.Angles(0,V*-F,0)local l=(O.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector O.Arm.Steer.MaxTorque=Vector3.new(math.abs(l.x),math.abs(l.y),math.abs(l.z))*50000 end for N,F in pairs(car.Wheels.RL:GetChildren())do F.Arm.Steer.cframe=F.Base.CFrame*CFrame.Angles(0,V*O,0)local l=(F.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector F.Arm.Steer.MaxTorque=Vector3.new(math.abs(l.x),math.abs(l.y),math.abs(l.z))*0 end for N,F in pairs(car.Wheels.RR:GetChildren())do F.Arm.Steer.cframe=F.Base.CFrame*CFrame.Angles(0,V*l,0)local O=(F.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector F.Arm.Steer.MaxTorque=Vector3.new(math.abs(O.x),math.abs(O.y),math.abs(O.z))*0 end GSteer=V end local function z()local N=1 if GMode==0 then O=car.DriveSeat.Steer elseif GMode==1 then local N=mouse.X-mouse.ViewSizeX/2 if math.abs(N)>u then local F=1 if N<0 then F=-1 end O=F*math.abs(math.max(-1,math.min(1,(N-u*F)/(e-u)))^Z)else O=0 end else if math.abs(LStickX)>Q then local N=1 if LStickX<0 then N=-1 end O=N*math.abs(math.max(-1,math.min(1,(LStickX-Q)/(1-Q)))^o)else O=0 end end U=V R=math.abs(U-O)*r if R~=0 then local l=math.min(1,math.min(tick()-F,R)/R)V=(U*(1-l)+O*l)*(1-i*math.min(1,math.abs((car.DriveSeat.Velocity.Magnitude/s)^c),N))end D()F=tick()end table.insert(LoopRun,z)end Steering()
---Steering
function Steering()
	local mode = 0

	local TUpdate = tick()
	local Steer = 0
	local CSteer = 0
	local CSteerTol = 3
	local CSteerPerc = 0.3
	local CPos = 0
	local KRef = 0
	local KTime = 1

	local FoAngle = math.rad(34)
	local FiAngle = math.rad(37)
	local RoAngle = math.rad(1)
	local RiAngle = math.rad(1)
	local RTime = 0.25
	local MWidth = 400
	local MExp = 2
	local KAdj = 0.7
	local KDecay = 350
	local KDExp = 1.65
	local DZone = 50

	local CExp = 2
	local CDZone = 0.1

	local function UpdateSteer()
		local fl = FoAngle
		local fr = FiAngle
		local rl = RoAngle
		local rr = RiAngle
		if CPos < 0 then
			fl = FiAngle
			fr = FoAngle
			rl = RiAngle
			rr = RoAngle
		end

		for i, v in pairs(car.Wheels.FL:GetChildren()) do
			--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*-fl,0)
			v.Arm.Steer.cframe = v.Base.CFrame * CFrame.Angles(0, CPos * -fl, 0)
			local look = (v.Base.CFrame * CFrame.Angles(math.pi / 2, 0, 0)).lookVector
			v.Arm.Steer.MaxTorque = Vector3.new(math.abs(look.x), math.abs(look.y), math.abs(look.z)) * 50000
		end
		for i, v in pairs(car.Wheels.FR:GetChildren()) do
			--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*-fr,0)
			v.Arm.Steer.cframe = v.Base.CFrame * CFrame.Angles(0, CPos * -fr, 0)
			local look = (v.Base.CFrame * CFrame.Angles(math.pi / 2, 0, 0)).lookVector
			v.Arm.Steer.MaxTorque = Vector3.new(math.abs(look.x), math.abs(look.y), math.abs(look.z)) * 50000
		end
		for i, v in pairs(car.Wheels.RL:GetChildren()) do
			--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*rl,0)
			v.Arm.Steer.cframe = v.Base.CFrame * CFrame.Angles(0, CPos * rl, 0)
			local look = (v.Base.CFrame * CFrame.Angles(math.pi / 2, 0, 0)).lookVector
			v.Arm.Steer.MaxTorque = Vector3.new(math.abs(look.x), math.abs(look.y), math.abs(look.z)) * 00000
		end
		for i, v in pairs(car.Wheels.RR:GetChildren()) do
			--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*rr,0)
			v.Arm.Steer.cframe = v.Base.CFrame * CFrame.Angles(0, CPos * rr, 0)
			local look = (v.Base.CFrame * CFrame.Angles(math.pi / 2, 0, 0)).lookVector
			v.Arm.Steer.MaxTorque = Vector3.new(math.abs(look.x), math.abs(look.y), math.abs(look.z)) * 00000
		end
		GSteer = CPos
	end

	local function getSteer()
		--local rot=(car.DriveSeat.RotVelocity*(car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector)/CSteerTol
		--local CS=rot.x+rot.y+rot.z
		--CSteer=(CS+Steer)*(1-math.abs(Steer))

		local SLimit = 1
		if GMode == 0 then
			Steer = car.DriveSeat.Steer
		elseif GMode == 1 then
			--SLimit=0
			local MPos = mouse.X - (mouse.ViewSizeX / 2)
			if math.abs(MPos) > DZone then
				local sPos = 1
				if MPos < 0 then
					sPos = -1
				end
				Steer = sPos * math.abs(math.max(-1, math.min(1, (MPos - (DZone * sPos)) / (MWidth - DZone))) ^ MExp)
			else
				Steer = 0
			end
		else
			--SLimit=0
			if math.abs(LStickX) > CDZone then
				local sPos = 1
				if LStickX < 0 then
					sPos = -1
				end
				Steer = sPos * math.abs(math.max(-1, math.min(1, (LStickX - CDZone) / (1 - CDZone))) ^ CExp)
			else
				Steer = 0
			end
		end

		KRef = CPos
		KTime = math.abs(KRef - Steer) * RTime
		if KTime ~= 0 then
			local t = math.min(1, math.min(tick() - TUpdate, KTime) / KTime)
			CPos = ((KRef * (1 - t)) + (Steer * t))
				* (1 - (KAdj * math.min(1, math.abs((car.DriveSeat.Velocity.Magnitude / KDecay) ^ KDExp), SLimit)))
		end
		UpdateSteer()
		TUpdate = tick()
	end

	--run:BindToRenderStep("Steer",Enum.RenderPriority.Last.Value,getSteer)
	--table.insert(Binded,"Steer")
	--table.insert(Binded,getSteer)
	table.insert(LoopRun, getSteer)
end
Steering()
