<aside> 🚨 Warning! Player IDs are confusing & not recommended! You can give a better experience by saying things like “Someone won the lottery!” instead of “Player #734 won the lottery!”
</aside>
Player IDs are a way to show specific players and their actions. You can set them up fairly easily.
The code below, once put into the On Join event will give new players an ID.
globalstat players + 1
if stat id = 0 then
stat id = %%globalstat_players%%
-- You can even add special actions for new players here!
end
Maybe you want players ID to show when they join, this is how you do that. First, you’ll need to enable the Join Messages gamerule. Then, do the following in your On Join action (after the code above):
globalstat temporaryid = %%stat_id%%
run function announcejoin for all players
You may have seen we call a function called announceJoin, this is what you’ll put in there!
send message: "They are also known as %%globalstat_temporaryid%%"
This will now send after their join message!
Of course, you can also make a function for when a player gets a rare drop and announce it that way instead of when they join.