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

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-.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-.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
