local I=script.Parent.Parent.Car.Value local T=workspace.FilteringEnabled local N=require(I["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local l=N.Redline local x=WasteGatePressure local w=0 local t=0 local o=CompressionRatio local c=TurboCount local J=I:WaitForChild("\085\112\100\097\116\101\065\110\100\077\097\107\101")local E=script.Parent.Parent.Values local y=script.Parent.Parent.Values.Throttle.Value local X=1-y local s=1 local V=0 local v=0 local u=I.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local Q=I.DriveSeat:WaitForChild("\066\079\086")u:Play()script.Parent.Parent.Values.RPM.Changed:connect(function()if E.Horsepower.Value==0 then w=w+(((((E.RPM.Value*(E.Throttle.Value*1.2))/l)/8.5-(w/WasteGatePressure)*(WasteGatePressure/15))*((36/TurboSize)*2))/WasteGatePressure)*15 if w<.05 then w=.05 end if w>2 then w=2 end end if E.Horsepower.Value>0 then w=w+(((((E.Horsepower.Value*(E.Throttle.Value*1.2))/N.Horsepower)/8+(.028-((w/WasteGatePressure)*(WasteGatePressure/15))*1.2))*((36/TurboSize)*2))/WasteGatePressure)*15 if w<.05 then w=.05 end if w>2 then w=2 end end t=w/2 if T then local I=w J:FireServer(w,t,y,X,BOV_Loudness,TurboLoudness,BOV_Pitch)else local T=y local N=I.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local l=I.DriveSeat:WaitForChild("\066\079\086")local x=l.Volume if T<0 then T=0 end N.Pitch=w N.Volume=(w/4)*TurboLoudness l.Pitch=(1-(-w/20))*BOV_Pitch l.Volume=(-0.5+(w/2)*BOV_Loudness)*(1-script.Parent.Parent.Values.Throttle.Value)end end)
--Values--
local car = script.Parent.Parent.Car.Value
local FE = workspace.FilteringEnabled
local _Tune = require(car["A-Chassis Tune"])
local Redline = _Tune.Redline
local maxPSI = WasteGatePressure
local totalPSI = 0
local actualPSI = 0
local CR = CompressionRatio
local TC = TurboCount
local handler = car:WaitForChild("UpdateAndMake")
local Values = script.Parent.Parent.Values
local Throttle = script.Parent.Parent.Values.Throttle.Value
local BOVFix = (1 - Throttle)
local tester = 1
local BOVact = 0
local BOVact2 = 0
local Whistle = car.DriveSeat:WaitForChild("Whistle")
local BOV = car.DriveSeat:WaitForChild("BOV")
Whistle:Play()

script.Parent.Parent.Values.RPM.Changed:connect(function()
	--When In Neutral
	if Values.Horsepower.Value == 0 then
		totalPSI = totalPSI
			+ (
				(
					(
						(
							((Values.RPM.Value * (Values.Throttle.Value * 1.2) / Redline) / 8.5)
							- (totalPSI / WasteGatePressure * (WasteGatePressure / 15))
						) * ((36 / TurboSize) * 2)
					) / WasteGatePressure
				) * 15
			)
		if totalPSI < 0.05 then
			totalPSI = 0.05
		end
		if totalPSI > 2 then
			totalPSI = 2
		end
		--TEST
	end
	--When Driving
	if Values.Horsepower.Value > 0 then
		totalPSI = totalPSI
			+ (
				(
					(
						(
							((Values.Horsepower.Value * (Values.Throttle.Value * 1.2) / _Tune.Horsepower) / 8)
							+ (0.028 - ((totalPSI / WasteGatePressure * (WasteGatePressure / 15)) * 1.2))
						) * ((36 / TurboSize) * 2)
					) / WasteGatePressure
				) * 15
			)
		if totalPSI < 0.05 then
			totalPSI = 0.05
		end
		if totalPSI > 2 then
			totalPSI = 2
		end
		--TEST
	end

	actualPSI = totalPSI / 2

	if FE then
		local BP = totalPSI

		handler:FireServer(totalPSI, actualPSI, Throttle, BOVFix, BOV_Loudness, TurboLoudness, BOV_Pitch)
	else
		local Throttle2 = Throttle
		local W = car.DriveSeat:WaitForChild("Whistle")
		local B = car.DriveSeat:WaitForChild("BOV")

		local bvol = B.Volume

		if Throttle2 < 0 then
			Throttle2 = 0
		end
		W.Pitch = totalPSI
		W.Volume = (totalPSI / 4) * TurboLoudness
		B.Pitch = (1 - (-totalPSI / 20)) * BOV_Pitch
		B.Volume = ((-0.5 + ((totalPSI / 2) * BOV_Loudness)) * (1 - script.Parent.Parent.Values.Throttle.Value))
	end
end)
