How can I assign a number to a character in multiplayer and then add a certain widget to their screen?

I want to be able to assign a number to each player so when I choose a random player to be the robber, it picks one of them and only adds a certain widget to their screen whilst everybody else gets a different one

Multiplayer on network or splitscreen? Widgets only exist on the client. Every player has its own HUD and associated playercontroller. Meaning that if you create a widget, you can just read the owning controller from either another widget or the HUD, then get the index from there with UGameplayStatics::GetPlayerControllerID

That would certainly work for a splitscreen / offline multiplayer. Haven’t ran into the situation yet where I need to do this online, that is different. Online you can get a unique index from APlayerState::GetPlayerID.

PlayerId | Unreal Engine Documentation