so I have gamemodes working… kinda. now I need to get weapons. but for some reason it’s trying to find a number rather than an object within the weapons folder. my code:
weaponofchoice = game:GetService("ServerStorage").Weapons.Bloxers
local weapon = weaponofchoice[math.random(1, #weaponofchoice:GetChildren())]
obviously leaving out some details that I don’t think is necessary for this part of the script, but let me know if you do need it to figure it out. please help
The reason it’s trying to find a number is because you’re feeding it a number as an argument, no?
If you do something like:
weaponofchoice = game:GetService("ServerStorage").Weapons.Bloxers:GetChildren()
local weapon = weaponofchoice[math.random(1, #weaponofchoice:GetChildren())]
This would work just fine because you’re choosing a random number and getting an index from a table instead of looking for something named a random number.