if autoscaling then local y={}if _Tune.Config=="\070\087\068"or _Tune.Config=="\065\087\068"then if car.Wheels:FindFirstChild("\070\076")~=nil then table.insert(y,car.Wheels.FL)end if car.Wheels:FindFirstChild("\070\082")~=nil then table.insert(y,car.Wheels.FR)end if car.Wheels:FindFirstChild("\070")~=nil then table.insert(y,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(y,car.Wheels.RL)end if car.Wheels:FindFirstChild("\082\082")~=nil then table.insert(y,car.Wheels.RR)end if car.Wheels:FindFirstChild("\082")~=nil then table.insert(y,car.Wheels.R)end end local J=0 for y,K in pairs(y)do if K.Size.x>J then J=K.Size.x end end y=nil for y,K in pairs(UNITS)do K.maxSpeed=math.ceil((((((K.scaling*J)*math.pi)*_lRPM)/60)/_Tune.Ratios[#_Tune.Ratios])/_Tune.FinalDrive)K.spInc=math.max(math.ceil(K.maxSpeed/200)*20,20)end end if script.Parent.Parent.IsOn.Value then end script.Parent.Parent.IsOn.Changed:connect(function()if script.Parent.Parent.IsOn.Value then end end)script.Parent.Parent.Values.Gear.Changed:connect(function()local y=script.Parent.Parent.Values.Gear.Value if y==0 then y="\078"elseif y==-1 then y="\082"end script.Parent.Gear.Text=y end)function PBrake()script.Parent.PBrake.Visible=script.Parent.Parent.Values.PBrake.Value end script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)script.Parent.Parent.Values.Velocity.Changed:connect(function(y)script.Parent.Speed.Text=math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude)..(" "..UNITS[currentUnits].units)end)script.Parent.Speed.MouseButton1Click:connect(function()if currentUnits==#UNITS then currentUnits=1 else currentUnits=currentUnits+1 end script.Parent.Speed.Text=math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.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)
		v.spInc = math.max(math.ceil(v.maxSpeed / 200) * 20, 20)
	end
end

if script.Parent.Parent.IsOn.Value then
end

script.Parent.Parent.IsOn.Changed:connect(function()
	if script.Parent.Parent.IsOn.Value then
	end
end)

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

function PBrake()
	script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)

script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
	script.Parent.Speed.Text = math.floor(
		UNITS[currentUnits].scaling * script.Parent.Parent.Values.Velocity.Value.Magnitude
	) .. " " .. UNITS[currentUnits].units
end)

script.Parent.Speed.MouseButton1Click:connect(function()
	if currentUnits == #UNITS then
		currentUnits = 1
	else
		currentUnits = currentUnits + 1
	end
	script.Parent.Speed.Text = math.floor(
		UNITS[currentUnits].scaling * script.Parent.Parent.Values.Velocity.Value.Magnitude
	) .. " " .. UNITS[currentUnits].units
end)

wait(0.1)
PBrake()
