local R=workspace.FilteringEnabled local u=script.Parent.Car.Value local l=require(u["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local f=0 script:WaitForChild("\082\101\118")script:WaitForChild("\083\117\112\101\114\099\104\097\114\103\101\114")if not R then for R,u in pairs(u.DriveSeat:GetChildren())do for R,l in pairs(script:GetChildren())do if u.Name==l.Name then u:Stop()wait()u:Destroy()end end end for R,l in pairs(script:GetChildren())do l.Parent=u.DriveSeat end u.DriveSeat.Rev:Play()u.DriveSeat.Supercharger:Play()while wait()do local R=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then f=math.max(f-.015,0)else f=1 end u.DriveSeat.Rev.Pitch=(u.DriveSeat.Rev.SetPitch.Value+(u.DriveSeat.Rev.SetRev.Value*R)/l.Redline)*f^2 u.DriveSeat.Supercharger.Pitch=(u.DriveSeat.Supercharger.SetPitch.Value+(u.DriveSeat.Supercharger.SetRev.Value*R)/l.Redline)*f^2 end else local R=u.AC6_FE_Sounds R:FireServer("\110\101\119\083\111\117\110\100","\082\101\118",u.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)R:FireServer("\112\108\097\121\083\111\117\110\100","\082\101\118")local m=0 while wait()do local u=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then f=math.max(f-.015,0)else f=1 end m=(script.Supercharger.SetPitch.Value+(script.Supercharger.SetRev.Value*u)/l.Redline)*f^2 m=(script.Supercharger.SetPitch.Value+(script.Supercharger.SetRev.Value*u)/l.Redline)*f^2 R:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,m,script.Rev.Volume)end end

local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0

script:WaitForChild("Rev")
script:WaitForChild("Supercharger")

if not FE 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
	for i,v in pairs(script:GetChildren()) do
		v.Parent=car.DriveSeat
	end
	
	car.DriveSeat.Rev:Play()
	car.DriveSeat.Supercharger:Play()
	while wait() do
		local _RPM = script.Parent.Values.RPM.Value
		
		if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
		car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
		car.DriveSeat.Supercharger.Pitch = (car.DriveSeat.Supercharger.SetPitch.Value + car.DriveSeat.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
	end
else
	local handler = car.AC6_FE_Sounds
	handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
	handler:FireServer("playSound","Rev")
	local pitch=0
	while wait() do
		local _RPM = script.Parent.Values.RPM.Value
		
		if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
		pitch = (script.Supercharger.SetPitch.Value + script.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
		pitch = (script.Supercharger.SetPitch.Value + script.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
		handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
	end
end
