My question is, is it possible to get a Players percentage chance when using math.random?
My current piece of code may enlighten you:
local randomPlayer = players[math.random(1,#players)]
Since math.random chooses a random object out of a certain table etc…, I was wondering, if a player has bought a x2 Chance gamepass, how would they be more likely to get picked?
This post has a system that can do that by assigning weights to each player. It will need some modification but this would allow you to double the weights of any player who bought the gamepass.
It works by giving every player a weight. Then when it comes to selecting a player it loops through all the weights and with a random number between 1 and the Sum of all the Weights waits till one player’s weight brings that random number from being positive to negative.
This system would work similar to the role selection in Murder Mystery 2 where you are able to increase the chance of a player being selected except it still is random who is picked.