Hi! I made this module to help developers easily pick random items with different chances. You can use it to create systems like MM2’s murderer selection or Pet Sim’s egg-opening mechanics.
It works by taking a dictionary where each key is assigned a numerical chance, and then outputs a random value based on those chances. For example:
These values do not need to be in numerical order or add up to 1, as the module handles that for you! This means you can use dictionaries with any positive numbers! For example:
No, the module will automatically adjust the percentage chance based on the other items in the dictionary. For example if the dictionary had only 1 key with value of 0.3, then it will have a 100% chance of being chosen.
-- Since theres only 1 value here, 'Pet1' will have a 100% chance of being chosen
local exampleDict = {
["Pet1"] = 0.3, --100% chance
}