Is there a best practice for how to give a player a number based on their position in a Segment? For example, the first player joins the segment and gets their player data key "Number" set to "0", the second player joins the segment and gets their player data key "Number" set to "1", etc. Or is there already a position number setup at join-time/tag-time/etc. instead of just a general "total" number of players in a Segment?
,I'm curious if there's a suggested / best practice method of setting custom player data key/value combination when a player arrives in a segment.
I initially attempted to setup a rule (on player entering a segment) and run a CloudScript function to give the player a number based on the number of players in the segment. But nothing seemed to happen. (The function didn't seem to get called when player was tagged and entered into the segment.) So, I setup a CloudScript to run if the player didn't already have that key/value set and to give them a value based on the number of players in the segment. Obviously, of course, this ended up with multiple players getting the same number given to them as players were tagged into the segment relatively quickly and then the players were checked on if they needed the value set, and found that there were # people in the segment and both got assigned the same number.
Basically, I would like each player in a Segment to have a "Player Number". (This needs to not change without a specific call to change it from some other function down the road.) When a player joins a Segment, I want them to be given the latest available number. For example, the first player to join will be "0" (yeah, I wanna start there), then the second would be "1", and the third "2", and so-on.
Does a number/position number already exist for Segments? Or are there any suggestions on best way to set this for each player?