local x=workspace.FilteringEnabled local e=script.Parent.Car.Value local P=require(e["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local S=0 script:WaitForChild("\082\101\118")script:WaitForChild("\084\117\114\098\111")if not x then for x,e in pairs(e.DriveSeat:GetChildren())do for x,P in pairs(script:GetChildren())do if e.Name==P.Name then e:Stop()wait()e:Destroy()end end end for x,P in pairs(script:GetChildren())do P.Parent=e.DriveSeat end e.DriveSeat.Rev:Play()e.DriveSeat.Turbo:Play()while wait()do local x=script.Parent.Values.RPM.Value if not e.DriveSeat.IsOn.Value then S=math.max(S-.015,0)else S=1 end e.DriveSeat.Rev.Pitch=(e.DriveSeat.Rev.SetPitch.Value+(e.DriveSeat.Rev.SetRev.Value*x)/P.Redline)*S^2 e.DriveSeat.Turbo.Pitch=(e.DriveSeat.Turbo.SetPitch.Value+(e.DriveSeat.Turbo.SetRev.Value*x)/P.Redline)*S^2 end else local x=e.AC6_FE_Sounds x:FireServer("\110\101\119\083\111\117\110\100","\082\101\118",e.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)x:FireServer("\112\108\097\121\083\111\117\110\100","\082\101\118")x:FireServer("\110\101\119\083\111\117\110\100","\084\117\114\098\111",e.DriveSeat,script.Turbo.SoundId,0,script.Turbo.Volume,true)x:FireServer("\112\108\097\121\083\111\117\110\100","\084\117\114\098\111")local j=0 local s=0 while wait()do local z=script.Parent.Values.RPM.Value if not e.DriveSeat.IsOn.Value then S=math.max(S-.015,0)else S=1 end j=(script.Rev.SetPitch.Value+(script.Rev.SetRev.Value*z)/P.Redline)*S^2 s=(script.Turbo.SetPitch.Value+(script.Turbo.SetRev.Value*z)/P.Redline)*S^2 x:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\082\101\118",script.Rev.SoundId,j,script.Rev.Volume)x:FireServer("\117\112\100\097\116\101\083\111\117\110\100","\084\117\114\098\111",script.Turbo.SoundId,s,script.Turbo.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("Rev")
script:WaitForChild("Turbo")

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.Rev:Play()
	car.DriveSeat.Turbo: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.DriveSeat.Rev.Pitch = (
			car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value * _RPM / _Tune.Redline
		) * on ^ 2
		car.DriveSeat.Turbo.Pitch = (
			car.DriveSeat.Turbo.SetPitch.Value + car.DriveSeat.Turbo.SetRev.Value * _RPM / _Tune.Redline
		) * on ^ 2
	end
else
	local handler = car.AC6_FE_Sounds
	handler:FireServer("newSound", "Rev", car.DriveSeat, script.Rev.SoundId, 0, script.Rev.Volume, true)
	handler:FireServer("playSound", "Rev")
	handler:FireServer("newSound", "Turbo", car.DriveSeat, script.Turbo.SoundId, 0, script.Turbo.Volume, true)
	handler:FireServer("playSound", "Turbo")
	local pitch = 0
	local pitch2 = 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
		pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value * _RPM / _Tune.Redline) * on ^ 2
		pitch2 = (script.Turbo.SetPitch.Value + script.Turbo.SetRev.Value * _RPM / _Tune.Redline) * on ^ 2
		handler:FireServer("updateSound", "Rev", script.Rev.SoundId, pitch, script.Rev.Volume)
		handler:FireServer("updateSound", "Turbo", script.Turbo.SoundId, pitch2, script.Turbo.Volume)
	end
end
