Rarity title not assigning correctgly

local rarityDictionary = {
	["Basic"] = 30,
	["Unique"] = 20,
	["Rare"] = 10,
	["Elite"] = 2,
	["Legendary"] = 0.01,
	["Boundless"] = 0.0005,
	["Secret"] = 0.000005
	
}
local rarityType
	for key, rarityNumber in next, rarityDictionary do
		if rarityNumber <= rarity then
			print(rarityNumber)
			print(rarity)
			rarityType = key
			print(key)
			break
		else
			print(key.."not correct")
		end
	end

image
why is every pet defaultiung to elite?

I never use next, but what is the value of rarity you are expecting?

its that second print in the picture, 20. if it is 20, then the rarity shoudl be unique because 30 is not equal to or less than, but unique is

ok, so if i take the break out, it still doesnt work, but i found the issue. it is checking elite first, instead of basic. why is that happening?

I’m not sure. I wouldn’t index them by string, I would index them by number.