How do I get the player counter number to display on a message hud device?

I saw that here, They have a function called “get count”. I want to use that function to show the player count in a message hud device that I set up earlier,
How would I go about doing this?

The HUD message device has a function called “SetText” which takes in a message as a parameter. Get the player count, convert it to a message, then update the HUD device text.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

show_player_count := class(creative_device):

    @editable
    PlayerCounter : player_counter_device = player_counter_device{}
    
    @editable
    HudMessageDevice : hud_message_device = hud_message_device{}

    # Converts a string to a message
    StringToMessage<localizes>(String : string) : message = "{String}"
    
    OnBegin<override>()<suspends>:void=
        loop:
            # Update the text of the HUD device
            HudMessageDevice.SetText(StringToMessage("{PlayerCounter.GetCount()}"))
            # Render the updated HUD device
            HudMessageDevice.Show()
            Sleep(1.0)
2 Likes