# Hey i'm working on a ranked system for my game, how can I hide a hud message device for one player only?

**URL:** <https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, editor, question, Blueprint, fortnite\
**Created:** [January 15, 2024, 7:02am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095 "2024-01-15T07:02:44Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 15, 2024, 7:02am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/1 "2024-01-15T07:02:44Z")

</div>

Here is my current code:

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation/Tags }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using {/UnrealEngine.com/Temporary/UI }
using { /Verse.org/Colors/NamedColors }

# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.

# A Verse-authored creative device that can be placed in a level

spawner := class(tag){}

sentries := class(tag){}

TextForUI< localizes>(InText : string, Agent : agent) : message = "💀 {Agent}'s Kills: {InText}"

TextForUI2< localizes>(InText : string) : message = "🎯 Goal For \n Next Rank: {InText}"

KillTrackUI := class(creative_device):

    var playerMap : [player]KillTrackUI = map{}

    var CurrentGoal : int = 0
    
    @editable Tracker : tracker_device = tracker_device{}

    @editable Bronze : hud_message_device = hud_message_device{}

    @editable SilverR : hud_message_device = hud_message_device{}
    
    InitSpawners():void =
        Spawners := GetCreativeObjectsWithTag(spawner{})

        for (Obj : Spawners):
            if (Spawner := player_spawner_device[Obj]):
                Spawner.SpawnedEvent.Subscribe(OnPlayerAdded)

    # Runs when the device is started in a running game
    OnBegin< override>()< suspends>:void=
        # TODO: Replace this with your code
        Print("Kill ui device has started")
        InitSpawners()
        GetPlayspace().PlayerRemovedEvent().Subscribe(OnPlayerRemoved)
    
    SpawnKillLoop(Player : player, TextBlock : text_block, Agent : agent)<suspends>:void = 
        loop: 
            Sleep(0.1) 
            if (AgentStats := playerMap[Player]):
                TextBlock.SetText(TextForUI("{Tracker.GetValue(Player)}", Agent))
                    

    RankSpawnLoop(Player: player, Agent : agent, TextBlock : text_block)<suspends>:void =
        loop:
            Sleep(0.1)
            if (Tracker.GetValue(Player) >= 15):
                if (PlayerUi := GetPlayerUI[Player]):
                    Bronze.Show(Agent)
                    TextBlock.SetText(TextForUI2("50"))
                    break
        loop:
            Sleep(0.1)
            if (Tracker.GetValue(Player) >= 50):
                if (PlayerUi := GetPlayerUI[Player]):
                    SilverR.Show(Agent)
                    TextBlock.SetText(TextForUI2("150"))
                    break

    
    OnPlayerAdded(NewPlayer : agent): void =
        Print("Player Added")
        if (PlayerObj := player[NewPlayer]):
            if (PlayerExists := playerMap[NewPlayer]):
            
            else:
                if (set playerMap[PlayerObj] = KillTrackUI{}):
                    if(AgentStats := playerMap[PlayerObj]):
                        if (FortChar:fort_character := NewPlayer.GetFortCharacter[]):
                            if (PlayerUi := GetPlayerUI[PlayerObj]):
                                var TextBlock2 : text_block = text_block{DefaultTextColor:= Beige}

                                #Does Player Have Rank?
                                if (Tracker.GetValue(PlayerObj) < 15):
                                    MyCanvas2:=canvas:
                                        Slots:=array:
                                            canvas_slot:
                                                Anchors := anchors{Minimum := vector2{X := 0.025, Y := 0.35}, Maximum := vector2{X := 0.025, Y := 0.35}}
                                                Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                                                Alignment := vector2{X := 0.025, Y := 0.35}
                                                SizeToContent := true
                                                Widget := TextBlock2
                                    Print("Canvas Should be added")
                                    PlayerUi.AddWidget(MyCanvas2)
                                    TextBlock2.SetText(TextForUI2("15"))

                                #Check If Is On Bronze Rank
                                if (Tracker.GetValue(PlayerObj) >= 15):
                                    Bronze.Show(NewPlayer)
                                    MyCanvas2:=canvas:
                                        Slots:=array:
                                            canvas_slot:
                                                Anchors := anchors{Minimum := vector2{X := 0.025, Y := 0.35}, Maximum := vector2{X := 0.025, Y := 0.35}}
                                                Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                                                Alignment := vector2{X := 0.025, Y := 0.35}
                                                SizeToContent := true
                                                Widget := TextBlock2
                                    Print("Canvas Should be added")
                                    PlayerUi.AddWidget(MyCanvas2)
                                    TextBlock2.SetText(TextForUI2("50"))
                                    if (Tracker.GetValue(PlayerObj) >= 50):
                                        SilverR.Show(NewPlayer)
                                        TextBlock2.SetText(TextForUI2("150"))
                                        
                                

                                #Creating Total Kills Ui
                                    
                                var TextBlock : text_block = text_block{DefaultTextColor:= White}
                                    MyCanvas:=canvas:
                                        Slots:=array:
                                            canvas_slot:
                                                Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.05}, Maximum := vector2{X := 0.5, Y := 0.05}}
                                                Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                                                Alignment := vector2{X := 0.5, Y := 0.05}
                                                SizeToContent := true
                                                Widget := TextBlock
                                    Print("Canvas Should be added")
                                    PlayerUi.AddWidget(MyCanvas)
                                    spawn{SpawnKillLoop(PlayerObj, TextBlock, NewPlayer)}

                                    spawn{RankSpawnLoop(PlayerObj, NewPlayer, TextBlock2)}
                

    OnPlayerRemoved(PlayerLeave : player):void =
        if(ActualPlayer := playerMap[PlayerLeave]):
            var TempPlayerMap:[player]KillTrackUI = map{}
            for(Key -> Value : playerMap, Key <> PlayerLeave):
                set TempPlayerMap = ConcatenateMaps(TempPlayerMap, map{Key => Value})
            
            set playerMap = TempPlayerMap

```

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 15, 2024, 7:39am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/2 "2024-01-15T07:39:40Z")

</div>

Do you mean HUDMessageDevice.Hide(Agent)

Depending on your use case you could maybe also put all hud message devices on the same layer and set a higher priority for message devices of higher ranks. This depends if you want players to be able to derank or not

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 15, 2024, 6:22pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/3 "2024-01-15T18:22:57Z")

</div>

When I try HudMessageDevice.Hide(Agent) it comes up with an error

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 16, 2024, 11:18am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/4 "2024-01-16T11:18:33Z")

</div>

Could you give some extra information on where you want to hide the hud message device for an agent? and about the error you’re getting?

---

<div class="post-metadata">

**Author:** ![ULTM\_Salih](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ULTM\_Salih](https://forums.unrealengine.com/u/ULTM_Salih)\
**Post date:** [January 17, 2024, 1:56pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/5 "2024-01-17T13:56:28Z")

</div>

Hi bro im creating map to so i dont know how to code verse and i dont have Time to learn it because im student do you can send me your Ranked code verse when its fonctional please

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 18, 2024, 2:05am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/6 "2024-01-18T02:05:01Z")

</div>

Why would I do this, you wouldn’t understand the code and you wouldn’t be able to figure what to change in the code to make it work with your map

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 18, 2024, 2:05am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/7 "2024-01-18T02:05:44Z")

</div>

Look Here

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/7/3a7eb81500c3f65a3b2621275da47760b5838989.png)

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 18, 2024, 8:03am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/8 "2024-01-18T08:03:16Z")

</div>

Could you post your whole code?

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 18, 2024, 8:06am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/9 "2024-01-18T08:06:43Z")

</div>

Correct me if I’m wrong but I think you’re also able to use the priority system I described in post 2. It depends on whether you want people to derank or not.

---

<div class="post-metadata">

**Author:** ![Rhakys11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rhakys11](https://forums.unrealengine.com/u/Rhakys11)\
**Post date:** [January 18, 2024, 9:11am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/10 "2024-01-18T09:11:11Z")

</div>

In the Editor, in your HUDMessage settings, you can set your message recipient to Enemies for instance. And then when in Verse you do HUDMessage.Show(Agent) it will show it only to the enemies of Agent.

But if your Agent is in a team and you want to show the message to the team, that wouldn’t work.  
In that case you could have an array or map of all players, and when you want to send a message to all but Agent, you make a function that takes your Agent as a parameter, you loop through the array and call HUDMessage.Show() on all agents except the one passed as a parameter.

Does that help?

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 18, 2024, 8:21pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/11 "2024-01-18T20:21:36Z")

</div>

No I don’t want people to able to derank

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 18, 2024, 10:06pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/12 "2024-01-18T22:06:58Z")

</div>

In that case you have an easy solution. Hud Message Devices have a priority system (lower is better). You can give your hud message device with the Bronze rank a priority of 10, your message device of silver a priority of 9, gold 8, etc. This will only show the Message device with the lowest priority. Make sure the setting ‘layer’ is the same value for all message devices.

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 18, 2024, 10:32pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/13 "2024-01-18T22:32:18Z")

</div>

And if the silver one has a higher priority then it would hide the bronze rank with lower priority?

---

<div class="post-metadata">

**Author:** ![JamieDeGamie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JamieDeGamie](https://forums.unrealengine.com/u/JamieDeGamie)\
**Post date:** [January 20, 2024, 3:57pm UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/14 "2024-01-20T15:57:45Z")

</div>

yes, because only one message can appear per layer, so the one with the worse priority will be hidden. Keep note that Hud Message Devices work kinda weird and their priority system isn’t normal. with hud devices the lower the priority the better. That’s why you would give bronze a high priorit (10 for example) silver lower (9 for example) and so forth

---

<div class="post-metadata">

**Author:** ![pinkskyee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pinkskyee](https://forums.unrealengine.com/u/pinkskyee)\
**Post date:** [January 21, 2024, 12:42am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/15 "2024-01-21T00:42:25Z")

</div>

Thanks, I will test it out!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 20, 2024, 12:43am UTC](https://forums.unrealengine.com/t/hey-im-working-on-a-ranked-system-for-my-game-how-can-i-hide-a-hud-message-device-for-one-player-only/1616095/16 "2024-02-20T00:43:11Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
