local S=workspace.FilteringEnabled local z=script.Parent.Car.Value local J=z:WaitForChild("\065\067\054\095\070\069\095\083\111\117\110\100\115")local U=require(z["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local K=0 local t=0 local v=0 script:WaitForChild("\083\117\112\101\114")for S,z in pairs(z.DriveSeat:GetChildren())do for S,J in pairs(script:GetChildren())do if z.Name==J.Name then z:Stop()wait()z:Destroy()end end end J:FireServer("\110\101\119\083\111\117\110\100","\083\117\112\101\114",z.DriveSeat,script.Super.SoundId,0,script.Super.Volume,true)J:FireServer("\112\108\097\121\083\111\117\110\100","\083\117\112\101\114")z.DriveSeat:WaitForChild("\083\117\112\101\114")while wait()do local Q=script.Parent.Values.RPM.Value if script.Parent.Values.Throttle.Value<=U.IdleThrottle/100 then t=math.max(.3,t-.2)else t=math.min(1,t+.1)end if script.Parent.Values.RPM.Value>U.Redline-U.RevBounce/4 and script.Parent.Values.Throttle.Value>U.IdleThrottle/100 then v=.5 else v=1 end if not script.Parent.IsOn.Value then K=math.max(K-.015,0)else K=1 end local l=math.max((script.Super.SetPitch.Value+(script.Super.SetSuper.Value*Q)/U.Redline)*K^2,script.Super.SetPitch.Value)if S then J:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\083\117\112\101\114",script.Super.SoundId,l,script.Super.Volume)else z.DriveSeat.Super.Pitch=l 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

script:WaitForChild("Super")

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

handler:FireServer("newSound", "Super", car.DriveSeat, script.Super.SoundId, 0, script.Super.Volume, true)
handler:FireServer("playSound", "Super")
car.DriveSeat:WaitForChild("Super")

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.Super.SetPitch.Value + script.Super.SetSuper.Value * _RPM / _Tune.Redline) * on ^ 2),
		script.Super.SetPitch.Value
	)
	if FE then
		handler:FireServer("updateSound", "Super", script.Super.SoundId, Pitch, script.Super.Volume)
	else
		car.DriveSeat.Super.Pitch = Pitch
	end
end
