local w=script.Parent.Parent.Car.Value local n=workspace.FilteringEnabled local a=require(w["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local g=a.Redline local Q=WasteGatePressure local I=0 local C=0 local W=CompressionRatio local P=TurboCount local V=w:WaitForChild("\085\112\100\097\116\101\065\110\100\077\097\107\101")local M=script.Parent.Parent.Values local m=script.Parent.Parent.Values.Throttle.Value local k=1-m local G=1 local f=0 local p=0 local t=w.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local d=w.DriveSeat:WaitForChild("\066\079\086")t:Play()script.Parent.Parent.Values.RPM.Changed:connect(function()if M.Horsepower.Value==0 then I=I+(((((M.RPM.Value*(M.Throttle.Value*1.2))/g)/9-.053)*(69/TurboSize))/WasteGatePressure)*15 if I<.05 then I=.05 end if I>2 then I=2 end end if M.Horsepower.Value>0 then I=I+((((((M.Horsepower.Value*(M.Throttle.Value*1.2))/a.Horsepower)/9-.063)*69)/TurboSize)/WasteGatePressure)*15 if I<.05 then I=.05 end if I>2 then I=2 end end C=I/2 if n then local w=I V:FireServer(I,C,m,k)else local n=m local a=w.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")local g=w.DriveSeat:WaitForChild("\066\079\086")if n<0 then n=0 end a.Pitch=I a.Volume=I/4 g.Pitch=1-(-I/40)g.Volume=((-0.03+I/2)*(1-m))/2 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.053) * (69 / TurboSize))
					/ 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.063)
						* 69
						/ TurboSize
					) / 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)
	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
		B.Pitch = 1 - (-totalPSI / 40)
		B.Volume = ((-0.03 + totalPSI / 2) * (1 - Throttle)) / 2
	end
end)
