local x=workspace.FilteringEnabled local g=script.Parent.Car.Value local u=g:WaitForChild("\065\067\054\095\070\069\095\083\111\117\110\100\115")local e=require(g["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local Y=0 local v=0 local R=0 script:WaitForChild("\084\117\114\098\111")for x,g in pairs(g.DriveSeat:GetChildren())do for x,u in pairs(script:GetChildren())do if g.Name==u.Name then g:Stop()wait()g:Destroy()end end end u:FireServer("\110\101\119\083\111\117\110\100","\084\117\114\098\111",g.DriveSeat,script.Turbo.SoundId,0,script.Turbo.Volume,true)u:FireServer("\112\108\097\121\083\111\117\110\100","\084\117\114\098\111")g.DriveSeat:WaitForChild("\084\117\114\098\111")while wait()do local G=script.Parent.Values.RPM.Value local E=script.Parent.Values.Boost.Value if script.Parent.Values.Throttle.Value<=e.IdleThrottle/100 then v=math.max(.3,v-.2)else v=math.min(1,v+.1)end if script.Parent.Values.RPM.Value>e.Redline-e.RevBounce/4 and script.Parent.Values.Throttle.Value>e.IdleThrottle/100 then R=.5 else R=1 end if not script.Parent.IsOn.Value then Y=math.max(Y-.015,0)else Y=1 end local r=math.max((script.Turbo.SetPitch.Value+(script.Turbo.SetRev.Value*G)/e.Redline)*Y^2,script.Turbo.SetPitch.Value)if x then u:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\084\117\114\098\111",script.Turbo.SoundId,r,script.Turbo.Volume)else g.DriveSeat.Turbo.Pitch=r 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 on = 0
local throt=0
local redline=0

script:WaitForChild("Turbo")


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

handler:FireServer("newSound","Turbo",car.DriveSeat,script.Turbo.SoundId,0,script.Turbo.Volume,true)
handler:FireServer("playSound","Turbo")
car.DriveSeat:WaitForChild("Turbo")

while wait() do
	local _RPM = script.Parent.Values.RPM.Value
	local _Turbo = script.Parent.Values.Boost.Value 
	if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
		throt = math.max(.3,throt-.2)	
	else
		throt = math.min(1,throt+.1)	
	end	
	if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
		redline=.5
	else
		redline=1
	end
	if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
	local Pitch = math.max((((script.Turbo.SetPitch.Value + script.Turbo.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Turbo.SetPitch.Value)
	if FE then
		handler:FireServer("updateSound","Turbo",script.Turbo.SoundId,Pitch,script.Turbo.Volume)
	else
		car.DriveSeat.Turbo.Pitch = Pitch
	end
end
