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

	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.Idle.Pitch = (
			car.DriveSeat.Idle.SetPitch.Value - car.DriveSeat.Idle.SetRev.Value * _RPM / _Tune.Redline
		) * on ^ 2
	end
else
	local handler = car.AC6_FE_Sounds
	handler:FireServer("newSound", "Idle", car.DriveSeat, script.Idle.SoundId, 0, true)
	handler:FireServer("playSound", "Idle")

	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.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
