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


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","Super",car.DriveSeat,script.Super.SoundId,0,script.Super.Volume,true)
handler:FireServer("playSound","Super")
car.DriveSeat:WaitForChild("Super")

while wait() do
	local _RPM = script.Parent.Values.RPM.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.Super.SetPitch.Value + script.Super.SetSuper.Value*_RPM/_Tune.Redline))*on^2),script.Super.SetPitch.Value)
	if FE then
		handler:FireServer("updateSound","Super",script.Super.SoundId,Pitch,script.Super.Volume)
	else
		car.DriveSeat.Super.Pitch = Pitch
	end
end
