local H=workspace.FilteringEnabled local e=script.Parent.Car.Value local d=e:WaitForChild("\065\067\054\095\070\069\095\083\111\117\110\100\115")local s=require(e["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local m=0 local c=0 local B=0 for H,e in pairs(e.DriveSeat:GetChildren())do for H,d in pairs(script:GetChildren())do if e.Name==d.Name then e:Stop()wait()e:Destroy()end end end while wait()do local o=script.Parent.Values.RPM.Value if script.Parent.Values.Throttle.Value<=s.IdleThrottle/100 then c=math.max(.3,c-.2)else c=math.min(1,c+.1)end if script.Parent.Values.RPM.Value>s.Redline-s.RevBounce/4 and script.Parent.Values.Throttle.Value>s.IdleThrottle/100 then B=.5 else B=1 end if not script.Parent.IsOn.Value then m=math.max(m-.015,0)else m=1 end local w=math.max((script.SetPitch.Value+(script.SetRev.Value*o)/s.Redline)*m^2,script.SetPitch.Value)if H then d:FireServer("\117\112\100\097\116\101\083\111\117\110\100",w)else e.DriveSeat.Rev.Pitch=w end end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt = 0
local redline = 0

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

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

	if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle / 100 then
		throt = math.max(0.3, throt - 0.2)
	else
		throt = math.min(1, throt + 0.1)
	end
	if
		script.Parent.Values.RPM.Value > _Tune.Redline - _Tune.RevBounce / 4
		and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle / 100
	then
		redline = 0.5
	else
		redline = 1
	end
	if not script.Parent.IsOn.Value then
		on = math.max(on - 0.015, 0)
	else
		on = 1
	end
	local Pitch =
		math.max(((script.SetPitch.Value + script.SetRev.Value * _RPM / _Tune.Redline) * on ^ 2), script.SetPitch.Value)
	if FE then
		handler:FireServer("updateSound", Pitch)
	else
		car.DriveSeat.Rev.Pitch = Pitch
	end
end
