if autoscaling then local z={}if _Tune.Config=="\070\087\068"or _Tune.Config=="\065\087\068"then if car.Wheels:FindFirstChild("\070\076")~=nil then table.insert(z,car.Wheels.FL)end if car.Wheels:FindFirstChild("\070\082")~=nil then table.insert(z,car.Wheels.FR)end if car.Wheels:FindFirstChild("\070")~=nil then table.insert(z,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(z,car.Wheels.RL)end if car.Wheels:FindFirstChild("\082\082")~=nil then table.insert(z,car.Wheels.RR)end if car.Wheels:FindFirstChild("\082")~=nil then table.insert(z,car.Wheels.R)end end local T=0 for z,f in pairs(z)do if f.Size.x>T then T=f.Size.x end end z=nil for z,f in pairs(UNITS)do f.maxSpeed=math.ceil((((((f.scaling*T)*math.pi)*_lRPM)/60)/_Tune.Ratios[#_Tune.Ratios])/_Tune.FinalDrive)f.spInc=math.max(math.ceil(f.maxSpeed/200)*20,20)end end local z=Instance.new("\070\114\097\109\101",script.Parent.Speedo)z.Name="\108\110\115"z.BackgroundTransparency=1 z.BorderSizePixel=0 z.Size=UDim2.new(0,0,0,0)for T=1,90,1 do local f=script.Parent.ln:clone()f.Parent=z f.Rotation=45+225*(T/90)if T%2==0 then f.Frame.Size=UDim2.new(0,2,0,10)f.Frame.Position=UDim2.new(0,-1,0,100)else f.Frame.Size=UDim2.new(0,3,0,5)end f.Num:Destroy()f.Visible=false end for z,T in pairs(UNITS)do local f=Instance.new("\070\114\097\109\101",script.Parent.Speedo)f.BackgroundTransparency=1 f.BorderSizePixel=0 f.Size=UDim2.new(0,0,0,0)f.Name=T.units if z~=1 then f.Visible=false end for z=0,T.maxSpeed,T.spInc do local X=script.Parent.ln:clone()X.Parent=f X.Rotation=45+225*(z/T.maxSpeed)X.Num.Text=z X.Num.TextSize=14 X.Num.Rotation=-X.Rotation X.Frame:Destroy()X.Num.Visible=true X.Visible=false end end script.Parent.Parent.Values.Gear.Changed:connect(function()local z=script.Parent.Parent.Values.Gear.Value if z==0 then z="\078"end if z==-1 then z="\082"end script.Parent.Gear.Text="\071\101\097\114 \058 "..(z.." \047 \054")end)local T=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")L=false T.InputBegan:connect(function(z,T)if not T then if z.KeyCode==Enum.KeyCode.Z then if L==false then script.Parent.Left.ImageColor3=Color3.fromRGB(142,255,169)L=true else script.Parent.Left.ImageColor3=Color3.fromRGB(255,255,255)L=false end end end end)

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

local lns = Instance.new("Frame",script.Parent.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 = script.Parent.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=false
end

for i,v in pairs(UNITS) do
	local lnn = Instance.new("Frame",script.Parent.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 = script.Parent.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=false
	end
end





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

local UIS = game:GetService("UserInputService")
L = false
UIS.InputBegan:connect(function(i,GP) if not GP then if i.KeyCode == Enum.KeyCode.Z then
if L == false then
script.Parent.Left.ImageColor3 = Color3.fromRGB(142, 255, 169)
L = true
else
script.Parent.Left.ImageColor3 = Color3.fromRGB(255,255,255)
L = false
end
end end end)