local V=workspace.FilteringEnabled local B=script.Parent.Car.Value local G=B:WaitForChild("\065\067\054\095\070\069\095\083\111\117\110\100\115")local F=require(B["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local K=0 local E=0 local L=5 local q=1 local c=2 script:WaitForChild("\087\104\105\115\116\108\101")script:WaitForChild("\066\079\086")for V,B in pairs(B.DriveSeat:GetChildren())do for V,G in pairs(script:GetChildren())do if B.Name==G.Name then B:Stop()wait()B:Destroy()end end end B.DriveSeat.ChildRemoved:connect(function(V)if V.Name=="\083\101\097\116\087\101\108\100"then for V,B in pairs(B.DriveSeat:GetChildren())do for V,G in pairs(script:GetChildren())do if B.Name==G.Name then B:Stop()wait()B:Destroy()end end end end end)G:FireServer("\110\101\119\083\111\117\110\100","\087\104\105\115\116\108\101",B.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)G:FireServer("\110\101\119\083\111\117\110\100","\066\079\086",B.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)G:FireServer("\112\108\097\121\083\111\117\110\100","\087\104\105\115\116\108\101")B.DriveSeat:WaitForChild("\087\104\105\115\116\108\101")B.DriveSeat:WaitForChild("\066\079\086")local X=tick()local m=0 if F.Aspiration=="\083\105\110\103\108\101"then m=1 elseif F.Aspiration=="\068\111\117\098\108\101"then m=2 end while wait()do local h=(script.Parent.Values.Boost.Value/(F.Boost*m))*2 K=math.floor(h*20)WP=h WV=(h/4)*c BP=(1-(-h/20))*q BV=(-0.5+(h/2)*L)*(1-script.Parent.Values.Throttle.Value)if K<E then if B.DriveSeat.BOV.IsPaused then if V then G:FireServer("\112\108\097\121\083\111\117\110\100","\066\079\086")else B.DriveSeat.BOV:Play()end end end if K>=E then if V then G:FireServer("\115\116\111\112\083\111\117\110\100","\066\079\086")else B.DriveSeat.BOV:Stop()end end if V then G:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\087\104\105\115\116\108\101",script.Whistle.SoundId,WP,WV)G:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\066\079\086",script.BOV.SoundId,BP,BV)else B.DriveSeat.Whistle.Pitch=WP B.DriveSeat.Whistle.Volume=WV B.DriveSeat.BOV.Pitch=BP B.DriveSeat.BOV.Volume=BV end if tick()-X>=.1 then E=math.floor(h*20)X=tick()end end

local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local BOVact = 0
local BOVact2 = 0

local BOV_Loudness = 5	--volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 1 	--max pitch of the BOV (not exact so might have to mess with it)
local TurboLoudness = 2 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)

script:WaitForChild("Whistle")
script:WaitForChild("BOV")

for i,v in pairs(car.DriveSeat:GetChildren()) do
	for _,a in pairs(script:GetChildren()) do
		if v.Name==a.Name then v:Stop() wait() v:Destroy() end
	end
end

car.DriveSeat.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then
		for i,v in pairs(car.DriveSeat:GetChildren()) do
			for _,a in pairs(script:GetChildren()) do
				if v.Name==a.Name then v:Stop() wait() v:Destroy() end
			end
		end
	end
end)

handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end

while wait() do
	local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
	
	BOVact = math.floor(psi*20)
	WP = (psi)
	WV = (psi/4)*TurboLoudness
	
	BP = (1-(-psi/20))*BOV_Pitch
	BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))

	if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
	if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
	
	if FE then
		handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
		handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
	else
		car.DriveSeat.Whistle.Pitch = WP
		car.DriveSeat.Whistle.Volume = WV
		car.DriveSeat.BOV.Pitch = BP
		car.DriveSeat.BOV.Volume = BV
	end
	if (tick()-ticc) >= 0.1 then
		BOVact2 = math.floor(psi*20)
		ticc = tick()
	end
end
