local Y=workspace.FilteringEnabled local C=script.Parent.Car.Value local O=C:WaitForChild("\065\067\054\095\070\069\095\083\111\117\110\100\115")local J=require(C["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local n=0 local D=0 local e=0 for Y,C in pairs(C.DriveSeat:GetChildren())do for Y,O in pairs(script:GetChildren())do if C.Name==O.Name then C:Stop()wait()C:Destroy()end end end while wait()do local p=script.Parent.Values.RPM.Value if script.Parent.Values.Throttle.Value<=J.IdleThrottle/100 then D=math.max(.3,D-.2)else D=math.min(1,D+.1)end if script.Parent.Values.RPM.Value>J.Redline-J.RevBounce/4 and script.Parent.Values.Throttle.Value>J.IdleThrottle/100 then e=.5 else e=1 end if not script.Parent.IsOn.Value then n=math.max(n-.015,0)else n=1 end local i=math.max((script.SetPitch.Value+(script.SetRev.Value*p)/J.Redline)*n^2,script.SetPitch.Value)if Y then O:FireServer("\117\112\100\097\116\101\083\111\117\110\100",i)else C.DriveSeat.Rev.Pitch=i end end

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(.3,throt-.2)	
	else
		throt = math.min(1,throt+.1)	
	end	
	if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
		redline=.5
	else
		redline=1
	end
	if not script.Parent.IsOn.Value then on=math.max(on-.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
