How would I make a system where I can determine the chance of things happening based on upgrades in my game?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I would like to make a chance system, as seen in games like “difficulty machine” or “Sword Factory X”

  2. What is the issue? The Issue is I am unable to find ways to do this.

  3. What solutions have you tried so far? I have looked and found there was no clear answer so I haven’t tried much other than my own solutions, of which, of course didn’t work.

use a Random object to generate random numbers. at the simplest level, you can use NextNumber to generate a number between 0 and 1 (basically a percent), compare if that number is less than x% (where x% if the chance of a thing happening), and if it is, make something happen. set x based on upgrades to increase or decrease the chances.

I mean you could create a value called upgrade, which obviously shows how many upgrades you’ve bought, based on that you could make a variable that holds the amount of upgrades like this

local upgrades = IntValue.Value --Change intvalue to the one you're using
local Min = upgrades - 5
local Max = upgrades + 5
local Random_value = math.Random(min, max)
print("Random is "..Random_value)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.