local m=workspace.FilteringEnabled local M=script.Parent.Car.Value local C=require(M["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local r=0 script:WaitForChild("\082\101\118")if not m then for m,M in pairs(M.DriveSeat:GetChildren())do for m,C in pairs(script:GetChildren())do if M.Name==C.Name then M:Stop()wait()M:Destroy()end end end for m,C in pairs(script:GetChildren())do C.Parent=M.DriveSeat end M.DriveSeat.Rev:Play()while wait()do local m=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then r=math.max(r-.015,0)else r=1 end M.DriveSeat.Rev.Pitch=(M.DriveSeat.Rev.SetPitch.Value+(M.DriveSeat.Rev.SetRev.Value*m)/C.PeakRPM)*r^2 end else local m=M.AC6_FE_Sounds m:FireServer("\110\101\119\083\111\117\110\100","\082\101\118",M.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)m:FireServer("\112\108\097\121\083\111\117\110\100","\082\101\118")local e=0 while wait()do local M=script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then r=math.max(r-.015,0)else r=1 end e=(script.Rev.SetPitch.Value+(script.Rev.SetRev.Value*M)/C.PeakRPM)*r^2 m:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,e,script.Rev.Volume)end end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]
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 - 0.015, 0)
		else
			on = 1
		end
		car.DriveSeat.Rev.Pitch = (
			car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value * _RPM / _Tune.PeakRPM
		) * 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 - 0.015, 0)
		else
			on = 1
		end
		pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value * _RPM / _Tune.PeakRPM) * on ^ 2
		handler:FireServer("updateSound", "Rev", script.Rev.SoundId, pitch, script.Rev.Volume)
	end
end
