This is supposed to be a simple card picker. There is a local script running which does animations and everything for a crate and then through a remote event tells the server which crate was bought. The server takes this then randomly gives a card which will eventually be given back to the client through a remote event. Only problem is this so far.
When comparing the number to the number in the table it returns nil. I have tried doing to number and to string. In the output, it’s getting the things it needs just can’t put them together:

I have looked around and from what I saw, no one has had the same issue as me.
local event = game.ReplicatedStorage.Crates.Cards.Rarity
local Common = {0, 0, 0, 0, 0, --[[]] 100, 100, 0, 0, 0, 0, 0,
0.1, 99, 0.8, 0.199, 0.001, --[[]] 99.9, 90, 7, 2, 0.8, 0.199, 0.001,
5, 99, 0.8, 0.199, 0.001, --[[]] 95, 79, 15, 5, 0.8, 0.199, 0.01}
event.OnServerEvent:Connect(function(player, rarity)
print(player)
print(rarity)
local card1type = math.random(1, 100000) / 1000
print(card1type)
print(tostring(rarity)[1])
if card1type > (tostring(rarity)[1]) then
print("Extra")
local card1rarity = math.random(1, 100000) / 1000
if card1rarity < rarity[12] then
print("Special")
elseif card1rarity < rarity[11] then
print("Legendary")
elseif card1rarity < rarity[10] then
print("Epic")
elseif card1rarity < rarity[9] then
print("Rare")
elseif card1rarity < rarity[8] then
print("Uncommon")
elseif card1rarity < rarity[7] then
print("Common")
end
else
print("Person")
end
end)