if autoscaling then local R={}if _Tune.Config=="\070\087\068"or _Tune.Config=="\065\087\068"then if car.Wheels:FindFirstChild("\070\076")~=nil then table.insert(R,car.Wheels.FL)end if car.Wheels:FindFirstChild("\070\082")~=nil then table.insert(R,car.Wheels.FR)end if car.Wheels:FindFirstChild("\070")~=nil then table.insert(R,car.Wheels.F)end end if _Tune.Config=="\082\087\068"or _Tune.Config=="\065\087\068"then if car.Wheels:FindFirstChild("\082\076")~=nil then table.insert(R,car.Wheels.RL)end if car.Wheels:FindFirstChild("\082\082")~=nil then table.insert(R,car.Wheels.RR)end if car.Wheels:FindFirstChild("\082")~=nil then table.insert(R,car.Wheels.R)end end local d=0 for R,e in pairs(R)do if e.Size.x>d then d=e.Size.x end end R=nil for R,e in pairs(UNITS)do e.maxSpeed=math.ceil(((((((e.scaling*d)*math.pi)*_lRPM)/60)/_Tune.Ratios[#_Tune.Ratios])/_Tune.FinalDrive)/_Tune.FDMult)e.spInc=math.max(math.ceil(e.maxSpeed/150)*10,10)end end for R=0,revEnd*2,1 do local d=gauges.ln:clone()d.Parent=gauges.Tach d.Rotation=45+(R*225)/(revEnd*2)d.Num.Text=R/2 d.Num.Rotation=-d.Rotation if R*500>=math.floor(_pRPM/500)*500 then d.Frame.BackgroundColor3=Color3.new(1,0,0)if R<revEnd*2 then ln2=d:clone()ln2.Parent=gauges.Tach ln2.Rotation=45+((R+.5)*225)/(revEnd*2)ln2.Num:Destroy()ln2.Visible=true end end if R%2==0 then d.Frame.Size=UDim2.new(0,3,0,10)d.Frame.Position=UDim2.new(0,-1,0,100)d.Num.Visible=true else d.Num:Destroy()end d.Visible=true end local R=Instance.new("\070\114\097\109\101",gauges.Speedo)R.Name="\108\110\115"R.BackgroundTransparency=1 R.BorderSizePixel=0 R.Size=UDim2.new(0,0,0,0)for d=1,90,1 do local e=gauges.ln:clone()e.Parent=R e.Rotation=45+225*(d/90)if d%2==0 then e.Frame.Size=UDim2.new(0,2,0,10)e.Frame.Position=UDim2.new(0,-1,0,100)else e.Frame.Size=UDim2.new(0,3,0,5)end e.Num:Destroy()e.Visible=true end local d=Instance.new("\070\114\097\109\101",gauges.Boost)d.Name="\098\108\110\115"d.BackgroundTransparency=1 d.BorderSizePixel=0 d.Size=UDim2.new(0,0,0,0)for R=0,12,1 do local e=gauges.bln:clone()e.Parent=d e.Rotation=45+270*(R/12)if R%2==0 then e.Frame.Size=UDim2.new(0,2,0,7)e.Frame.Position=UDim2.new(0,-1,0,40)else e.Frame.Size=UDim2.new(0,3,0,5)end e.Num:Destroy()e.Visible=true end for R,d in pairs(UNITS)do local e=Instance.new("\070\114\097\109\101",gauges.Speedo)e.BackgroundTransparency=1 e.BorderSizePixel=0 e.Size=UDim2.new(0,0,0,0)e.Name=d.units if R~=1 then e.Visible=false end for R=0,d.maxSpeed,d.spInc do local B=gauges.ln:clone()B.Parent=e B.Rotation=45+225*(R/d.maxSpeed)B.Num.Text=R B.Num.TextSize=14 B.Num.Rotation=-B.Rotation B.Frame:Destroy()B.Num.Visible=true B.Visible=true end end if isOn.Value then gauges:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end isOn.Changed:connect(function()if isOn.Value then gauges:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end end)values.RPM.Changed:connect(function()gauges.Tach.Needle.Rotation=45+225*math.min(1,values.RPM.Value/(revEnd*1000))end)local e=0 if _Tune.Aspiration~="\078\097\116\117\114\097\108"then if _Tune.Aspiration=="\083\105\110\103\108\101"then e=1 elseif _Tune.Aspiration=="\068\111\117\098\108\101"then e=2 end values.Boost.Changed:connect(function()local R=math.floor(values.Boost.Value)*1.2-(_Tune.Boost*e)/5 gauges.Boost.Needle.Rotation=45+270*math.min(1,(values.Boost.Value/_Tune.Boost)/e)gauges.PSI.Text=tostring(math.floor(R).." \080\083\073")end)else gauges.Boost:Destroy()end values.Gear.Changed:connect(function()local R=values.Gear.Value if R==0 then R="\078"elseif R==-1 then R="\082"end gauges.Gear.Text=R end)values.TCS.Changed:connect(function()if _Tune.TCSEnabled then if values.TCS.Value then gauges.TCS.TextColor3=Color3.new(1,.66666666666667,0)gauges.TCS.TextStrokeColor3=Color3.new(1,.66666666666667,0)if values.TCSActive.Value then wait()gauges.TCS.Visible=not gauges.TCS.Visible else wait()gauges.TCS.Visible=false end else gauges.TCS.Visible=true gauges.TCS.TextColor3=Color3.new(1,0,0)gauges.TCS.TextStrokeColor3=Color3.new(1,0,0)end else gauges.TCS.Visible=false end end)values.TCSActive.Changed:connect(function()if _Tune.TCSEnabled then if values.TCSActive.Value and values.TCS.Value then wait()gauges.TCS.Visible=not gauges.TCS.Visible elseif not values.TCS.Value then wait()gauges.TCS.Visible=true else wait()gauges.TCS.Visible=false end else gauges.TCS.Visible=false end end)gauges.TCS.Changed:connect(function()if _Tune.TCSEnabled then if values.TCSActive.Value and values.TCS.Value then wait()gauges.TCS.Visible=not gauges.TCS.Visible elseif not values.TCS.Value then wait()gauges.TCS.Visible=true end else if gauges.TCS.Visible then gauges.TCS.Visible=false end end end)values.ABS.Changed:connect(function()if _Tune.ABSEnabled then if values.ABS.Value then gauges.ABS.TextColor3=Color3.new(1,.66666666666667,0)gauges.ABS.TextStrokeColor3=Color3.new(1,.66666666666667,0)if values.ABSActive.Value then wait()gauges.ABS.Visible=not gauges.ABS.Visible else wait()gauges.ABS.Visible=false end else gauges.ABS.Visible=true gauges.ABS.TextColor3=Color3.new(1,0,0)gauges.ABS.TextStrokeColor3=Color3.new(1,0,0)end else gauges.ABS.Visible=false end end)values.ABSActive.Changed:connect(function()if _Tune.ABSEnabled then if values.ABSActive.Value and values.ABS.Value then wait()gauges.ABS.Visible=not gauges.ABS.Visible elseif not values.ABS.Value then wait()gauges.ABS.Visible=true else wait()gauges.ABS.Visible=false end else gauges.ABS.Visible=false end end)gauges.ABS.Changed:connect(function()if _Tune.ABSEnabled then if values.ABSActive.Value and values.ABS.Value then wait()gauges.ABS.Visible=not gauges.ABS.Visible elseif not values.ABS.Value then wait()gauges.ABS.Visible=true end else if gauges.ABS.Visible then gauges.ABS.Visible=false end end end)function PBrake()gauges.PBrake.Visible=values.PBrake.Value end values.PBrake.Changed:connect(PBrake)values.Velocity.Changed:connect(function(R)gauges.Speedo.Needle.Rotation=45+225*math.min(1,(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude)/UNITS[currentUnits].maxSpeed)gauges.Speed.Text=math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude)..(" "..UNITS[currentUnits].units)end)mouse.KeyDown:connect(function(R)if R=="\118"then gauges.Visible=not gauges.Visible end end)gauges.Speed.MouseButton1Click:connect(function()if currentUnits==#UNITS then currentUnits=1 else currentUnits=currentUnits+1 end for R,d in pairs(gauges.Speedo:GetChildren())do d.Visible=d.Name==UNITS[currentUnits].units or d.Name=="\078\101\101\100\108\101"or d.Name=="\108\110\115"end gauges.Speed.Text=math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude)..(" "..UNITS[currentUnits].units)end)wait(.1)PBrake()
--Automatic Gauge Scaling
if autoscaling then
	local Drive = {}
	if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
		if car.Wheels:FindFirstChild("FL") ~= nil then
			table.insert(Drive, car.Wheels.FL)
		end
		if car.Wheels:FindFirstChild("FR") ~= nil then
			table.insert(Drive, car.Wheels.FR)
		end
		if car.Wheels:FindFirstChild("F") ~= nil then
			table.insert(Drive, car.Wheels.F)
		end
	end
	if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
		if car.Wheels:FindFirstChild("RL") ~= nil then
			table.insert(Drive, car.Wheels.RL)
		end
		if car.Wheels:FindFirstChild("RR") ~= nil then
			table.insert(Drive, car.Wheels.RR)
		end
		if car.Wheels:FindFirstChild("R") ~= nil then
			table.insert(Drive, car.Wheels.R)
		end
	end

	local wDia = 0
	for i, v in pairs(Drive) do
		if v.Size.x > wDia then
			wDia = v.Size.x
		end
	end
	Drive = nil
	for i, v in pairs(UNITS) do
		v.maxSpeed = math.ceil(
			v.scaling * wDia * math.pi * _lRPM / 60 / _Tune.Ratios[#_Tune.Ratios] / _Tune.FinalDrive / _Tune.FDMult
		)
		v.spInc = math.max(math.ceil(v.maxSpeed / 150) * 10, 10)
	end
end

for i = 0, revEnd * 2 do
	local ln = gauges.ln:clone()
	ln.Parent = gauges.Tach
	ln.Rotation = 45 + i * 225 / (revEnd * 2)
	ln.Num.Text = i / 2
	ln.Num.Rotation = -ln.Rotation
	if i * 500 >= math.floor(_pRPM / 500) * 500 then
		ln.Frame.BackgroundColor3 = Color3.new(1, 0, 0)
		if i < revEnd * 2 then
			ln2 = ln:clone()
			ln2.Parent = gauges.Tach
			ln2.Rotation = 45 + (i + 0.5) * 225 / (revEnd * 2)
			ln2.Num:Destroy()
			ln2.Visible = true
		end
	end
	if i % 2 == 0 then
		ln.Frame.Size = UDim2.new(0, 3, 0, 10)
		ln.Frame.Position = UDim2.new(0, -1, 0, 100)
		ln.Num.Visible = true
	else
		ln.Num:Destroy()
	end
	ln.Visible = true
end

local lns = Instance.new("Frame", gauges.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0, 0, 0, 0)
for i = 1, 90 do
	local ln = gauges.ln:clone()
	ln.Parent = lns
	ln.Rotation = 45 + 225 * (i / 90)
	if i % 2 == 0 then
		ln.Frame.Size = UDim2.new(0, 2, 0, 10)
		ln.Frame.Position = UDim2.new(0, -1, 0, 100)
	else
		ln.Frame.Size = UDim2.new(0, 3, 0, 5)
	end
	ln.Num:Destroy()
	ln.Visible = true
end

local blns = Instance.new("Frame", gauges.Boost)
blns.Name = "blns"
blns.BackgroundTransparency = 1
blns.BorderSizePixel = 0
blns.Size = UDim2.new(0, 0, 0, 0)
for i = 0, 12 do
	local bln = gauges.bln:clone()
	bln.Parent = blns
	bln.Rotation = 45 + 270 * (i / 12)
	if i % 2 == 0 then
		bln.Frame.Size = UDim2.new(0, 2, 0, 7)
		bln.Frame.Position = UDim2.new(0, -1, 0, 40)
	else
		bln.Frame.Size = UDim2.new(0, 3, 0, 5)
	end
	bln.Num:Destroy()
	bln.Visible = true
end

for i, v in pairs(UNITS) do
	local lnn = Instance.new("Frame", gauges.Speedo)
	lnn.BackgroundTransparency = 1
	lnn.BorderSizePixel = 0
	lnn.Size = UDim2.new(0, 0, 0, 0)
	lnn.Name = v.units
	if i ~= 1 then
		lnn.Visible = false
	end

	for i = 0, v.maxSpeed, v.spInc do
		local ln = gauges.ln:clone()
		ln.Parent = lnn
		ln.Rotation = 45 + 225 * (i / v.maxSpeed)
		ln.Num.Text = i
		ln.Num.TextSize = 14
		ln.Num.Rotation = -ln.Rotation
		ln.Frame:Destroy()
		ln.Num.Visible = true
		ln.Visible = true
	end
end

if isOn.Value then
	gauges:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 1, true)
end

isOn.Changed:connect(function()
	if isOn.Value then
		gauges:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 1, true)
	end
end)

values.RPM.Changed:connect(function()
	gauges.Tach.Needle.Rotation = 45 + 225 * math.min(1, values.RPM.Value / (revEnd * 1000))
end)

local _TCount = 0

if _Tune.Aspiration ~= "Natural" then
	if _Tune.Aspiration == "Single" then
		_TCount = 1
	elseif _Tune.Aspiration == "Double" then
		_TCount = 2
	end
	values.Boost.Changed:connect(function()
		local boost = (math.floor(values.Boost.Value) * 1.2) - ((_Tune.Boost * _TCount) / 5)
		gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1, (values.Boost.Value / _Tune.Boost / _TCount))
		gauges.PSI.Text = tostring(math.floor(boost) .. " PSI")
	end)
else
	gauges.Boost:Destroy()
end

values.Gear.Changed:connect(function()
	local gearText = values.Gear.Value
	if gearText == 0 then
		gearText = "N"
	elseif gearText == -1 then
		gearText = "R"
	end
	gauges.Gear.Text = gearText
end)

values.TCS.Changed:connect(function()
	if _Tune.TCSEnabled then
		if values.TCS.Value then
			gauges.TCS.TextColor3 = Color3.new(1, 170 / 255, 0)
			gauges.TCS.TextStrokeColor3 = Color3.new(1, 170 / 255, 0)
			if values.TCSActive.Value then
				wait()
				gauges.TCS.Visible = not gauges.TCS.Visible
			else
				wait()
				gauges.TCS.Visible = false
			end
		else
			gauges.TCS.Visible = true
			gauges.TCS.TextColor3 = Color3.new(1, 0, 0)
			gauges.TCS.TextStrokeColor3 = Color3.new(1, 0, 0)
		end
	else
		gauges.TCS.Visible = false
	end
end)

values.TCSActive.Changed:connect(function()
	if _Tune.TCSEnabled then
		if values.TCSActive.Value and values.TCS.Value then
			wait()
			gauges.TCS.Visible = not gauges.TCS.Visible
		elseif not values.TCS.Value then
			wait()
			gauges.TCS.Visible = true
		else
			wait()
			gauges.TCS.Visible = false
		end
	else
		gauges.TCS.Visible = false
	end
end)

gauges.TCS.Changed:connect(function()
	if _Tune.TCSEnabled then
		if values.TCSActive.Value and values.TCS.Value then
			wait()
			gauges.TCS.Visible = not gauges.TCS.Visible
		elseif not values.TCS.Value then
			wait()
			gauges.TCS.Visible = true
		end
	else
		if gauges.TCS.Visible then
			gauges.TCS.Visible = false
		end
	end
end)

values.ABS.Changed:connect(function()
	if _Tune.ABSEnabled then
		if values.ABS.Value then
			gauges.ABS.TextColor3 = Color3.new(1, 170 / 255, 0)
			gauges.ABS.TextStrokeColor3 = Color3.new(1, 170 / 255, 0)
			if values.ABSActive.Value then
				wait()
				gauges.ABS.Visible = not gauges.ABS.Visible
			else
				wait()
				gauges.ABS.Visible = false
			end
		else
			gauges.ABS.Visible = true
			gauges.ABS.TextColor3 = Color3.new(1, 0, 0)
			gauges.ABS.TextStrokeColor3 = Color3.new(1, 0, 0)
		end
	else
		gauges.ABS.Visible = false
	end
end)

values.ABSActive.Changed:connect(function()
	if _Tune.ABSEnabled then
		if values.ABSActive.Value and values.ABS.Value then
			wait()
			gauges.ABS.Visible = not gauges.ABS.Visible
		elseif not values.ABS.Value then
			wait()
			gauges.ABS.Visible = true
		else
			wait()
			gauges.ABS.Visible = false
		end
	else
		gauges.ABS.Visible = false
	end
end)

gauges.ABS.Changed:connect(function()
	if _Tune.ABSEnabled then
		if values.ABSActive.Value and values.ABS.Value then
			wait()
			gauges.ABS.Visible = not gauges.ABS.Visible
		elseif not values.ABS.Value then
			wait()
			gauges.ABS.Visible = true
		end
	else
		if gauges.ABS.Visible then
			gauges.ABS.Visible = false
		end
	end
end)

function PBrake()
	gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)

values.Velocity.Changed:connect(function(property)
	gauges.Speedo.Needle.Rotation = 45
		+ 225 * math.min(1, UNITS[currentUnits].scaling * values.Velocity.Value.Magnitude / UNITS[currentUnits].maxSpeed)
	gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling * values.Velocity.Value.Magnitude)
		.. " "
		.. UNITS[currentUnits].units
end)

mouse.KeyDown:connect(function(key)
	if key == "v" then
		gauges.Visible = not gauges.Visible
	end
end)

gauges.Speed.MouseButton1Click:connect(function()
	if currentUnits == #UNITS then
		currentUnits = 1
	else
		currentUnits = currentUnits + 1
	end
	for i, v in pairs(gauges.Speedo:GetChildren()) do
		v.Visible = v.Name == UNITS[currentUnits].units or v.Name == "Needle" or v.Name == "lns"
	end
	gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling * values.Velocity.Value.Magnitude)
		.. " "
		.. UNITS[currentUnits].units
end)

wait(0.1)
PBrake()
