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