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

if not FE then
	for i, v in pairs(car.Body.WHEEL: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.Body.WHEEL
	end

	car.Body.WHEEL.Wheel: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.Body.WHEEL.Wheel.Pitch = (
			car.Body.WHEEL.Wheel.SetPitch.Value + car.Body.WHEEL.Wheel.SetRev.Value * _RPM / _Tune.Redline
		) * on ^ 2

		if _RPM == 700 then
			car.Body.WHEEL.Wheel.Volume = 0.1
		end
	end
else
	local handler = car.AC6_FE_Sounds

	handler:FireServer("newSound", "Wheel", car.Body.WHEEL, script.Wheel.SoundId, 0, script.Wheel.Volume, true)
	handler:FireServer("playSound", "Wheel")

	local pitch4 = 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

		pitch4 = (script.Wheel.SetPitch.Value + script.Wheel.SetRev.Value * _RPM / _Tune.Redline) * on ^ 2

		handler:FireServer("updateSound", "Wheel", script.idle.SoundId, pitch4, script.Wheel.Volume)
	end
end
