How to randomise roles with every role must be in game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Linksy_CZ

Hello i am trying to do game like among us, bit i don´t know how to like get randomise roles. like:
1. Imposter
2. Imposter
3. Innocent
4. Doctor

Do you know how to randomise it, but there must be the same amount of roles?

:bust_in_silhouette: Reply From: crossbito

Hi! Put all the roles in an array and then shuffle the array to have a random order. Then set every player a role from that array.

Remember to use randomize() before shuffle to have different orders each time.

Hello i will try it and if i it wont work i will let you know.

Linksy_CZ | 2023-06-10 13:46

How do you mean randomize()? Can you make an example?

Linksy_CZ | 2023-06-10 13:55