local Q=script.Parent.Parent.Car.Value local I=workspace.FilteringEnabled local Z=require(Q["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local O=Z.Redline local R=WasteGatePressure local r=0 local v=0 local f=CompressionRatio local t=TurboCount local c=Q:WaitForChild("\085\112\100\097\116\101\065\110\100\077\097\107\101")local D=script.Parent.Parent.Values local Y=script.Parent.Parent.Values.Throttle.Value local N=1-Y local C=1 local q=0 local o=0 local X=Q.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local U=Q.DriveSeat:WaitForChild("\066\079\086")X:Play()script.Parent.Parent.Values.RPM.Changed:connect(function()if D.Horsepower.Value==0 then r=r+(((((D.RPM.Value*(D.Throttle.Value*1.2))/O)/9-.035)*((36/TurboSize)*2))/WasteGatePressure)*15 if r<.05 then r=.05 end if r>2 then r=2 end end if D.Horsepower.Value>0 then r=r+(((((D.Horsepower.Value*(D.Throttle.Value*1.2))/Z.Horsepower)/9-.045)*((36/TurboSize)*2))/WasteGatePressure)*15 if r<.05 then r=.05 end if r>2 then r=2 end end v=r/2 if I then local Q=r c:FireServer(r,v,Y,N,BOV_Loudness,TurboLoudness)else local I=Y local Z=Q.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local O=Q.DriveSeat:WaitForChild("\066\079\086")if I<0 then I=0 end Z.Pitch=r Z.Volume=(r/4)*TurboLoudness O.Pitch=1-(-r/40)O.Volume=(((-0.03+r/2)*(1-Y))/2)*BOV_Loudness 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) / 9) - 0.035) * (
							(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) / 9) - 0.045)
						* ((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)
	else
		local Throttle2 = Throttle
		local W = car.DriveSeat:WaitForChild("Whistle")
		local B = car.DriveSeat:WaitForChild("BOV")
		if Throttle2 < 0 then
			Throttle2 = 0
		end
		W.Pitch = totalPSI
		W.Volume = (totalPSI / 4) * TurboLoudness
		B.Pitch = 1 - (-totalPSI / 40)
		B.Volume = (((-0.03 + totalPSI / 2) * (1 - Throttle)) / 2) * BOV_Loudness
	end
end)
