Only one player getting gun in modified gun game?

Hello everyone! I am trying to make gun game randomize weapons, however when I went to test, I encountered an error: Only one player was getting a gun?

I have my code sample here of the script, and am willing to provide any function calls necessary!

function GivePlayerEquipment(player)

    -- Check which equipment to give to player
    local equipmentIndex = math.random(1, EQUIPMENT_COUNT)
    if equipmentIndex > EQUIPMENT_COUNT then
        equipmentIndex = EQUIPMENT_COUNT
    local equipmentToSpawn = EQUIPMENT_LIST:GetChildren()[equipmentIndex]:GetCustomProperty("Equipment")
    if not equipmentToSpawn then return end

    -- Spawn and equip the weapon to the player
    equipment[player] = World.SpawnAsset(equipmentToSpawn)

    Events.BroadcastToPlayer(player, "BannerMessage", "Equipped "[player].name)

Would you please provide the code block from which the GivePlayerEquipment was called. So far the function seems to be fine; I'm thinking the error lies in the context from which GivePlayerEquipment was called.

for _, player in ipairs(Game.GetPlayers()) do

This block is the Game.roundStartEvent

If you set the equipment index to 1 (as opposed to math.random(1, EQUIPMENT_COUNT) ) will all players receive a weapon (I'm thinking that some of the equipment indexes lead to empty equipment). Also, is this script networked or running in a server context?

@FleshyOverlord How would this make a difference? I tested this on a vanilla gun game framework with no modifications, and it had this issue

I'm thinking that only one of the items in the equipment list is valid, to test this I recommend setting the equipmentIndex to a fixed number as opposed to a random number.