local T=workspace.FilteringEnabled local G=script.Parent.Car.Value local o=require(G["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local H=0 script:WaitForChild("\082\101\118")if not T then for T,G in pairs(G.DriveSeat:GetChildren())do for T,o in pairs(script:GetChildren())do if G.Name==o.Name then G:Stop()wait()G:Destroy()end end end for T,o in pairs(script:GetChildren())do o.Parent=G.DriveSeat end G.DriveSeat.Rev:Play()while wait()do local T=script.Parent.Values.RPM.Value if not G.DriveSeat.IsOn.Value then H=math.max(H-.015,0)else H=1 end G.DriveSeat.Rev.Pitch=(G.DriveSeat.Rev.SetPitch.Value+(G.DriveSeat.Rev.SetRev.Value*T)/o.Redline)*H^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 y=0 while wait()do local R=script.Parent.Values.RPM.Value if not G.DriveSeat.IsOn.Value then H=math.max(H-.015,0)else H=1 end y=(script.Rev.SetPitch.Value+(script.Rev.SetRev.Value*R)/o.Redline)*H^2 if(script.Parent:FindFirstChild("\068\114\105\118\101\077\111\100\101")).Value~="\067\111\109\102\111\114\116"then T:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,y,script.Rev.Volume*2)else T:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,y/1.2,script.Rev.Volume/1.2)end 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
		if script.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
		 	handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume*2)
		else
			handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch/1.2,script.Rev.Volume/1.2)
		end
	end
end
