local F=require(car["\065-\067\104\097\115\115\105\115 \084\117\110\101"].README)print("\047\047\073\078\083\080\065\082\069\058 \065\067\054 \076\111\097\100\101\100 - \066\117\105\108\100 "..F)game["\082\117\110 \083\101\114\118\105\099\101"].Stepped:connect(function()Steering()RPM()_IsOn=car.DriveSeat.IsOn.Value _InControls=script.Parent.ControlsOpen.Value script.Parent.Values.Gear.Value=_CGear script.Parent.Values.RPM.Value=_RPM script.Parent.Values.Horsepower.Value=_HP script.Parent.Values.Torque.Value=(_HP*_Tune.EqPoint)/_RPM script.Parent.Values.TransmissionMode.Value=_TMode script.Parent.Values.Throttle.Value=_GThrot script.Parent.Values.Brake.Value=_GBrake script.Parent.Values.SteerC.Value=_GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-_Tune.MinSteer/100))script.Parent.Values.SteerT.Value=_GSteerT script.Parent.Values.PBrake.Value=_PBrake script.Parent.Values.TCS.Value=_TCS script.Parent.Values.TCSActive.Value=_TCSActive script.Parent.Values.ABS.Value=_ABS script.Parent.Values.ABSActive.Value=_ABSActive script.Parent.Values.MouseSteerOn.Value=_MSteer script.Parent.Values.Velocity.Value=car.DriveSeat.Velocity if car.DriveSeat.ABS.Value==true and car.DriveSeat.AS.Value==false then if car.DriveSeat.Velocity.Magnitude<80 then if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit*((car.DriveSeat.Velocity.Magnitude^1.05*.83333333333333)*.68181818181818)))and _CGear>1 then local F=workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit*((car.DriveSeat.Velocity.Magnitude^1.1*.83333333333333)*.68181818181818)))local Q=math.abs(F.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if Q>35 and((F.CanCollide==false or F.CanCollide==true or F.Parent.Name=="\066\111\100\121"or F.Parent.Parent.Name=="\066\111\100\121"or F.Parent.Name=="\087\104\101\101\108\115")and(F.Name~="\066\097\115\101\112\108\097\116\101"and F.Anchored==false))then if F.Velocity.Magnitude<5 or not F.Anchored then car.DriveSeat.AS.Value=true _GBrake=5 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end end end local F=.56818181818182 if script.Parent.CC.Value==true then if car.DriveSeat.Velocity.Magnitude*F-2>script.Parent.CCS.Value+.5 then _CThrot=0 _CBrake=.5 else _CThrot=1 _CBrake=0 end else _CThrot=0 end if _GBrake>0 then script.Parent.CC.Value=false end if car.DriveSeat.IsOn.Value==true and car.A.ACC.Value==true then _CGear=1 end end)script.Parent.Values.Brake.Changed:connect(function()if math.ceil(_GBrake)>0 then car.DriveSeat.FE_Lights:FireServer("\117\112\100\097\116\101\076\105\103\104\116\115","\098\114\097\107\101",true)else car.DriveSeat.FE_Lights:FireServer("\117\112\100\097\116\101\076\105\103\104\116\115","\098\114\097\107\101",false)end end)script.Parent.Values.Throttle.Changed:Connect(function()if math.ceil(_GThrot)>0 then if car.DriveSeat.AS.Value==true then car.DriveSeat.AS.Value=false _GBrake=0 end end end)while wait(.0667)do Engine()if _Tune.AutoFlip then Flip()end end


	--Print Version
	local ver=require(car["A-Chassis Tune"].README)
	print("//INSPARE: AC6 Loaded - Build "..ver)
	
	--Runtime Loops
	
	-- ~60 c/s
	game["Run Service"].Stepped:connect(function()
		--Steering
		Steering()
		
		--RPM
		RPM()
		
		--Update External Values
		_IsOn = car.DriveSeat.IsOn.Value
		_InControls = script.Parent.ControlsOpen.Value
		script.Parent.Values.Gear.Value = _CGear
		script.Parent.Values.RPM.Value = _RPM
		script.Parent.Values.Horsepower.Value = _HP
		script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
		script.Parent.Values.TransmissionMode.Value = _TMode
		script.Parent.Values.Throttle.Value = _GThrot
		script.Parent.Values.Brake.Value = _GBrake
		script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
		script.Parent.Values.SteerT.Value = _GSteerT
		script.Parent.Values.PBrake.Value = _PBrake
		script.Parent.Values.TCS.Value = _TCS
		script.Parent.Values.TCSActive.Value = _TCSActive
		script.Parent.Values.ABS.Value = _ABS
		script.Parent.Values.ABSActive.Value = _ABSActive
		script.Parent.Values.MouseSteerOn.Value = _MSteer
		script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
		
	
		if car.DriveSeat.ABS.Value == true and car.DriveSeat.AS.Value == false then	
			if car.DriveSeat.Velocity.Magnitude < 80 then
				if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.05)*(10/12) * (60/88)))) and (_CGear > 1) then
					local p = workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.1)*(10/12) * (60/88))))
					local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
					if aa > 35 and (p.CanCollide == false or p.CanCollide == true or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels") and (p.Name ~= "Baseplate") and (p.Anchored == false) then
						if (p.Velocity.Magnitude < 5 or not p.Anchored) then
							car.DriveSeat.AS.Value = true
							_GBrake = 5
							repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
							car.DriveSeat.AS.Value = false
						end
					end
				end
			end
		end		
		
		local mph = (10/12) * (60/88)
		if script.Parent.CC.Value == true then
			if (car.DriveSeat.Velocity.Magnitude*mph) - 2 > script.Parent.CCS.Value+0.5 then
				_CThrot = 0
				_CBrake = 0.5
				--repeat wait() until (car.DriveSeat.Velocity.Magnitude*mph) - 4 < script.Parent.CCS.Value
				--_CBrake = 0
			else
				_CThrot = 1
				_CBrake = 0
			end
		else
			_CThrot = 0
		end
		
		if _GBrake > 0 then
			script.Parent.CC.Value = false
		end		
		if car.DriveSeat.IsOn.Value == true and car.A.ACC.Value == true then
			_CGear = 1
		end		
	end)
	--script.Parent.CC.Changed:connect(function()
	--	if script.Parent.CC.Value == true then
		--	script.Parent.CCS.Value = math.floor(car.DriveSeat.Velocity.Magnitude*((10/12) * (60/88)))
		--end
	--end)

	script.Parent.Values.Brake.Changed:connect(function()
		if math.ceil(_GBrake) > 0 then
        	car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', true)
		else
        	car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', false)
		end
	end)

	script.Parent.Values.Throttle.Changed:Connect(function()
		if math.ceil(_GThrot) > 0 then
			if car.DriveSeat.AS.Value == true then
				car.DriveSeat.AS.Value = false
				_GBrake = 0
			end
		end
	end)
	
	-- ~15 c/s
	while wait(.0667) do
		--Power
		Engine()
		
		--Flip
		if _Tune.AutoFlip then Flip() end
	end
