function Steering()local j=0 local I=tick()local O=0 local w=0 local o=3 local h=.3 local J=0 local E=0 local R=1 local k=math.rad(34)local q=math.rad(37)local X=math.rad(1)local x=math.rad(1)local n=.25 local P=400 local g=2 local y=.7 local G=350 local A=1.65 local F=50 local H=2 local C=.1 local function t()local j=k local I=q local O=X local w=x if J<0 then j=q I=k O=x w=X end for I,O in pairs(car.Wheels.FL:GetChildren())do O.Arm.Steer.cframe=O.Base.CFrame*CFrame.Angles(0,J*-j,0)local w=(O.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector O.Arm.Steer.MaxTorque=Vector3.new(math.abs(w.x),math.abs(w.y),math.abs(w.z))*50000 end for j,O in pairs(car.Wheels.FR:GetChildren())do O.Arm.Steer.cframe=O.Base.CFrame*CFrame.Angles(0,J*-I,0)local w=(O.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector O.Arm.Steer.MaxTorque=Vector3.new(math.abs(w.x),math.abs(w.y),math.abs(w.z))*50000 end for j,I in pairs(car.Wheels.RL:GetChildren())do I.Arm.Steer.cframe=I.Base.CFrame*CFrame.Angles(0,J*O,0)local w=(I.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector I.Arm.Steer.MaxTorque=Vector3.new(math.abs(w.x),math.abs(w.y),math.abs(w.z))*0 end for j,I in pairs(car.Wheels.RR:GetChildren())do I.Arm.Steer.cframe=I.Base.CFrame*CFrame.Angles(0,J*w,0)local O=(I.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector I.Arm.Steer.MaxTorque=Vector3.new(math.abs(O.x),math.abs(O.y),math.abs(O.z))*0 end GSteer=J end local function N()local j=1 if GMode==0 then O=car.DriveSeat.Steer elseif GMode==1 then local j=mouse.X-mouse.ViewSizeX/2 if math.abs(j)>F then local I=1 if j<0 then I=-1 end O=I*math.abs(math.max(-1,math.min(1,(j-F*I)/(P-F)))^g)else O=0 end else if math.abs(LStickX)>C then local j=1 if LStickX<0 then j=-1 end O=j*math.abs(math.max(-1,math.min(1,(LStickX-C)/(1-C)))^H)else O=0 end end E=J R=math.abs(E-O)*n if R~=0 then local w=math.min(1,math.min(tick()-I,R)/R)J=(E*(1-w)+O*w)*(1-y*math.min(1,math.abs((car.DriveSeat.Velocity.Magnitude/G)^A),j))end t()I=tick()end table.insert(LoopRun,N)end Steering()

function Steering()
		local mode=0
		
		local TUpdate=tick()
		local Steer=0
		local CSteer=0
		local CSteerTol=3
		local CSteerPerc=.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=.25
		local MWidth=400
		local MExp=2
		local KAdj=.7
		local KDecay=350
		local KDExp=1.65
		local DZone=50
		
		local CExp=2
		local CDZone=.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()