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

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