local S=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 "..S)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>100 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.12*.83333333333333)*.68181818181818)))then local S=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 z=math.abs(S.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if z>35 and((S.CanCollide or S.Parent.Name=="\066\111\100\121"or S.Parent.Parent.Name=="\066\111\100\121"or S.Parent.Name=="\087\104\101\101\108\115")and S.Name~="\066\097\115\101\112\108\097\116\101")then if S.Velocity.Magnitude<5 or S.Anchored then car.DriveSeat.AS.Value=true _GBrake=1 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end else 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)))then local S=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 z=math.abs(S.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if z>35 and((S.CanCollide or S.Parent.Name=="\066\111\100\121"or S.Parent.Parent.Name=="\066\111\100\121"or S.Parent.Name=="\087\104\101\101\108\115")and S.Name~="\066\097\115\101\112\108\097\116\101")then if S.Velocity.Magnitude<5 or S.Anchored then car.DriveSeat.AS.Value=true _GBrake=1 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end end if workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit*6))and _CGear==-1 then local S=workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit*6))local z=math.abs(S.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if z>5 and S.CanCollide then if S.Velocity.Magnitude<5 or S.Anchored then car.DriveSeat.AS.Value=true _GBrake=1 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end if workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit*6))and _CGear==-1 then local S=workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit*6))local z=math.abs(S.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if z>5 and S.CanCollide then if S.Velocity.Magnitude<5 or S.Anchored then car.DriveSeat.AS.Value=true _GBrake=1 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end if workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit*6))and _CGear==-1 then local S=workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit*6))local z=math.abs(S.Velocity.Magnitude-car.DriveSeat.Velocity.Magnitude)if z>5 and S.CanCollide then if S.Velocity.Magnitude<5 or S.Anchored then car.DriveSeat.AS.Value=true _GBrake=1 repeat wait()until car.DriveSeat.Velocity.Magnitude<2 car.DriveSeat.AS.Value=false end end end 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
--[[Run]]

--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 > 100 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.12) * (10 / 12) * (60 / 88))
					)
				)
			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 or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels")
					and (p.Name ~= "Baseplate")
				then
					if p.Velocity.Magnitude < 5 or p.Anchored then
						car.DriveSeat.AS.Value = true
						_GBrake = 1
						repeat
							wait()
						until car.DriveSeat.Velocity.Magnitude < 2
						car.DriveSeat.AS.Value = false
					end
				end
			end
		else
			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))
					)
				)
			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 or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels")
					and (p.Name ~= "Baseplate")
				then
					if p.Velocity.Magnitude < 5 or p.Anchored then
						car.DriveSeat.AS.Value = true
						_GBrake = 1
						repeat
							wait()
						until car.DriveSeat.Velocity.Magnitude < 2
						car.DriveSeat.AS.Value = false
					end
				end
			end
		end

		if
			workspace:FindPartOnRay(
				Ray.new(
					snsrs.BMSL.RayEnd.CFrame.p,
					(snsrs.BMSL.RayEnd.CFrame.p - snsrs.BMSL.RayStart.CFrame.p).unit * 6
				)
			) and (_CGear == -1)
		then
			local p = workspace:FindPartOnRay(
				Ray.new(
					snsrs.BMSL.RayEnd.CFrame.p,
					(snsrs.BMSL.RayEnd.CFrame.p - snsrs.BMSL.RayStart.CFrame.p).unit * 6
				)
			)
			local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
			if aa > 5 and p.CanCollide then
				if p.Velocity.Magnitude < 5 or p.Anchored then
					car.DriveSeat.AS.Value = true
					_GBrake = 1
					repeat
						wait()
					until car.DriveSeat.Velocity.Magnitude < 2
					car.DriveSeat.AS.Value = false
				end
			end
		end

		if
			workspace:FindPartOnRay(
				Ray.new(
					snsrs.BMSR.RayEnd.CFrame.p,
					(snsrs.BMSR.RayEnd.CFrame.p - snsrs.BMSR.RayStart.CFrame.p).unit * 6
				)
			) and (_CGear == -1)
		then
			local p = workspace:FindPartOnRay(
				Ray.new(
					snsrs.BMSR.RayEnd.CFrame.p,
					(snsrs.BMSR.RayEnd.CFrame.p - snsrs.BMSR.RayStart.CFrame.p).unit * 6
				)
			)
			local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
			if aa > 5 and p.CanCollide then
				if p.Velocity.Magnitude < 5 or p.Anchored then
					car.DriveSeat.AS.Value = true
					_GBrake = 1
					repeat
						wait()
					until car.DriveSeat.Velocity.Magnitude < 2
					car.DriveSeat.AS.Value = false
				end
			end
		end

		if
			workspace:FindPartOnRay(
				Ray.new(snsrs.RS.RayEnd.CFrame.p, (snsrs.RS.RayEnd.CFrame.p - snsrs.RS.RayStart.CFrame.p).unit * 6)
			) and (_CGear == -1)
		then
			local p = workspace:FindPartOnRay(
				Ray.new(snsrs.RS.RayEnd.CFrame.p, (snsrs.RS.RayEnd.CFrame.p - snsrs.RS.RayStart.CFrame.p).unit * 6)
			)
			local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
			if aa > 5 and p.CanCollide then
				if p.Velocity.Magnitude < 5 or p.Anchored then
					car.DriveSeat.AS.Value = true
					_GBrake = 1
					repeat
						wait()
					until car.DriveSeat.Velocity.Magnitude < 2
					car.DriveSeat.AS.Value = false
				end
			end
		end
	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(0.0667) do
	--Power
	Engine()

	--Flip
	if _Tune.AutoFlip then
		Flip()
	end
end
