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

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.Idle:Play()

	while wait() do
		local _RPM = script.Parent.Values.RPM.Value

		if not car.DriveSeat.IsOn.Value then
			on = math.max(on - 0.015, 0)
		else
			on = 1
		end
		car.DriveSeat.Idle.Pitch = (
			car.DriveSeat.Idle.SetPitch.Value + car.DriveSeat.Idle.SetRev.Value * _RPM / _Tune.Redline
		) * on ^ 2
	end
else
	local handler = car.AC6_FE_Idle
	handler:FireServer("newSound", "Idle", car.DriveSeat, script.Idle.SoundId, 0, script.Idle.Volume, true)
	handler:FireServer("playSound", "Idle")
	local pitch = 0
	while wait() do
		local _RPM = script.Parent.Values.RPM.Value

		if not car.DriveSeat.IsOn.Value then
			on = math.max(on - 0.015, 0)
		else
			on = 1
		end
		pitch = (script.Idle.SetPitch.Value + script.Idle.SetRev.Value * _RPM / _Tune.Redline) * on ^ 2
		handler:FireServer("updateSound", "Idle", script.Idle.SoundId, pitch, script.Idle.Volume)
	end
end
