Random Role Assignments (Nevermind)

Posted by Arthur
EDIT: nevermind i found out about gms_other_find and gms_self_ismaster lmaoo

So my game is similar to Among Us in the way that it will randomly select one player to have a unique role while everyone else has the default one.

The way I did this is I assigned a number to each player upon joining the session. When the game starts, the host player will randomly pick a number from 1 to however many people are in the room. And whoever has that number will be chosen.

As you can imagine, this method creates a major issue when someone decides to leave. The host could end up selecting a number that doesn't belong to a player anymore. Or worse, the host could leave and nobody would get selected.

I've spent a while trying to kick everyone from the session if someone leaves, but not only is that not a good solution, I have repeatedly hit dead ends trying to do that.

I wanted to ask if there was a better way to randomly select one of the players in the room that I am overlooking.

Replies (0)

Last message on -