local T=workspace.FilteringEnabled local g=script.Parent.Car.Value local b=require(g["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local R=0 script:WaitForChild("\082\101\118")if not T then for T,g in pairs(g.DriveSeat:GetChildren())do for T,b in pairs(script:GetChildren())do if g.Name==b.Name then g:Stop()wait()g:Destroy()end end end for T,b in pairs(script:GetChildren())do b.Parent=g.DriveSeat end g.DriveSeat.Rev:Play()while wait()do local T=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then R=math.max(R-.015,0)else R=1 end g.DriveSeat.Rev.Pitch=((g.DriveSeat.Rev.SetPitch.Value+(g.DriveSeat.Rev.SetRev.Value*T)/b.Redline)*R)/1.2 end else local T=g.AC6_FE_Sounds T:FireServer("\110\101\119\083\111\117\110\100","\082\101\118",g.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)T:FireServer("\112\108\097\121\083\111\117\110\100","\082\101\118")local G=0 while wait()do local g=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then R=math.max(R-.015,0)else R=1 end G=((script.Rev.SetPitch.Value+(script.Rev.SetRev.Value*g)/b.Redline)*R)/1.2 T:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,G,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")

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()
	
	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/1.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.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on/1.2
		handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
	end
end
