I’m trying to make a political simulation game. I understand how to randomly select/call a player out of all online players. However, I want to increase the chances of a player being chosen whether from a gamepass or whatnot (possibly being in a group or on an admin list also).
Is it possible to somehow combine the total player list with a special list to double the chances for certain players? If so how’d I go about doing that?
Here’s an older post I’ve been using to randomly select a player:
The best way to do this that I can think of off the top of my head would just be storing all the players you have to pick from within a table and adding multiple entries if they own a gamepads that gives them a higher chance. I don’t believe it’s possible to weight the results when getting it from Players:GetPlayers().
local function SelectAUser(Querylist)
local SelectionArray = {};
for _,g in pairs(Querylist)do
table.insert(SelectionArray, g);
if(PlayerMeetsCondition)then
table.insert(SelectionArray,g);
end;
end;
return SelectionArray[math.random(1,#SelectionArray)];
end;
--//
local User = SelectAUser(game:GetService("Players"):GetPlayers());