I am adding a crate system to my game and I have never done this before so I am following a tutorial I found on the dev forum, however I am doing it a little different to fit my game.
Everything is going smoothly but I am stuck on the part where I have to randomly select a group of items to be put into the spinner based on the odds of the crate. First I am doing a common crate and here are the odds for that crate.
CommonChance = 0.6
UnCommonChance = 0.3
RareChance = 0.1
I have all the items that can be in crates in 3 different folders in ServerStorage. One folder is Accessories, one is Faces, and the other is costumes. Each item has a Color3Value based on the rarity. I did this so it would be easier to make the UI. So common is grey, uncommon is green ect… In the tutorial what it says to do is create a group of 45 random items and just pick the 40th one to be the winner. I like this however I can’t figure out how to create that random group. How can I create a function to go through all the folders and pick out 45 random items following the odds and put them in a group.