With variables, is it a random chance for each one? Im trying to figure out an easier way to make drop chances happen in scripts

for instance, i click a button which gives me a chance to get a sword. The chance of a higher tier sword dropping is dependant on the percentage. but is there an easier way to do it?

The script rolls a random number between the numbers you chose. In my case (when I changed the script), I rolled a number between 1 and 3. If my number landed on 1, I get 1 apple. If my number landed on two, I get 2 apples.

To answer your question, this is way better for drop chances. Say you have wood swords and iron swords. You will roll a random number between 1-5, upon pressing the button. Wood sword has the values of 1,3,5 and iron sword has 2,4. Rolling 1,3,5 will give a wood sword, and rolling 2 or 4 will give iron sword. Now, let's say iron sword has a value of 3. Rolling a 3 will give you both the iron and wood sword.