I think you had a hard time understanding my question because my English is poor.
Since my English is poor, I would like to ask for your understanding in advance about asking questions through a translator (Papago).
My question is as follows.
1. When a civilian player (not AI!) activated the trigger, it should be changed to Blufor with 50% probability and Opfor with the remaining 50% probability.
2. The number of each Blufor and Opfor player that has been changed cannot exceed half of the total number of civilian players.
If one side first reaches half the total number of civilian players, it is not allowed to be changed to that team and should be changed to the other team.
Example) If there are 100 civilian players, then the number of people who changed to Blufor and Opfor should be 50:50. 49:51. It should be 50:50. If Blufor reaches 50 first, the remaining civilian players should change to Opfor unconditionally.
3. After the team changes, a message should be printed to confirm that the team of the player who activated the trigger has changed correctly. I think it would be a good idea to mark this as a hint.
I had no choice but to borrow your strength because my abilities were at a non-existent level.
I've been using Ghat GPT for a week, but basically my lack of ability and I couldn't figure out what part of the code he created was wrong.