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