How would I make a case opening system?

Hello friends! I haven’t scripted in a while, so I’m feeling a little rusty. I’m working on a project and I need a case system (The type you would find in MM2 or Jailbreak I assume).

I have a pretty good scripting knowledge, and I always make a structure of how the logic and code is gonna be for different scenarios. I have already made the “structure”, but I lack the knowledge to implement some of the key features, such as:

  • Scrolling through the different items:
    The server will select the item, based on a chance/weight system probably stored in a modulescript. The server will then tell the client which item is picked but then what?
    How would I make it so the UIListlayout will stop at the right item?

  • Generating the list:
    How would I go about generating the “list” it will scroll through and make it so there will be as many “Legendary” items based on it’s chance (Let’s say there’s a 1% chance of getting a Legendary. Then I want there to be 1% legendary frames in the list, and 60% Common frames etc.)

Here’s a tutorial that I read recently that might be helpful to you: tutorial