local RP = game.ReplicatedStorage local Directory = { Pets = { ["Dog"] = { Name = "Dog", Rarity = "Common", Level = "1" }, ["Cat"] = { Name = "Cat", Rarity = "Common", Level = "1" } } } RP["OpenEgg"].OnServerEvent:Connect(function(plr, arg1, arg2) local Pet = Directory.Pets[math.random(1, #Directory.Pets)] print(Pet) end)
its telling me #Directory.Pets is 0 when it clearly isnt
rather then using math.random i prefer to use the Random.new()
for example
local rng = Random.new() print(rng:NextInteger(5, 10)) -- will print a value between 5 and 10
you should use math.random(number) to get a random number to use as a randomizer to pick a pet from the table