Hi There thanks for clicking to help 
(Note Idk if its the right heading sorry if it is not. )
I want the for loop to match the random number with the lowest number first, but it doesn’t seem to work.

As you can see in this screenshot if the numbers are 1 then it just Chooses the “Bunny Pet”, and I need it to choose the “Fox Pet”.
local RS = game:GetService("ReplicatedStorage")
local Tier1 = RS:FindFirstChild("Tier1")
local PetsFolder = RS:WaitForChild("Pets")
Tier1.OnServerEvent:Connect(function()
local PetWeight = {
['FoxWeight'] = 1,
['BearWeight'] = 4,
['BullWeight'] = 10,
['BunnyWeight'] = 15,
['DogWeight'] = 20,
['CatWeight'] = 50,
}
local Pets = {
Bear = PetsFolder.Bear,
Bull = PetsFolder.Bull,
Bunny = PetsFolder.Bunny,
Cat = PetsFolder.Cat,
Dog = PetsFolder.Dog,
Fox = PetsFolder.Fox
}
local Number = math.random(1, 100) ---- Get a random number between 1 and 100
for i,PetWeight in pairs(PetWeight) do
local Counter = 0
Counter = Counter + PetWeight
if Number <= Counter then
print(i.. " " .. Number)
return
end
end
end)
I tried to see if it works in the order the table is written and it didn’t fix the issue, I even tried to see if it reads the table in alphabetical order and yet it still didn’t work.
Is there anyone who can please help me. I’ve been struggling with this for almost an hour now.
Thank You!