# How do I define this function type and parameters

**URL:** <https://forums.unrealengine.com/t/how-do-i-define-this-function-type-and-parameters/2670969>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [November 2, 2025, 1:39pm UTC](https://forums.unrealengine.com/t/how-do-i-define-this-function-type-and-parameters/2670969 "2025-11-02T13:39:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spicymage](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spicymage](https://forums.unrealengine.com/u/Spicymage)\
**Post date:** [November 2, 2025, 1:39pm UTC](https://forums.unrealengine.com/t/how-do-i-define-this-function-type-and-parameters/2670969/1 "2025-11-02T13:39:02Z")

</div>

Hi, I can’t figure out what to write to define the function below.

The goal of my code is to give a vfx to the top score player.

(tbh I’ve never coded anything in my life, it’s kinda hard rn😂)

```auto
OnElim() : =
        var PlayerList:[]tuple(agent, int) = for {Agent -> Score : PlayerScores} do {Agent, Score} # Create a list of players and their scores
        set PlayerList = SortPlayerList(PlayerList) # Sort the player list by scores

        if (PlayerList1 := PlayerList[0]): # Get the first player, will fail if there isn't one.
            PlayerReference1.Register(PlayerList1(0)) # Set the first player reference

            if : PlayerList1(0) HasEffect
                return # do nothing
            else :
                Crown_VFX.pickup(PlayerList1(0))

```

Also, here is the full code : (tell me if you see anything wrong tho)

```auto
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /Verse.org/Verse }

crown_device := class(creative_device):

    @editable Crown_VFX : visual_effect_powerup_device = visual_effect_powerup_device{}
    @editable PlayerSpawner : player_spawner_device = player_spawner_device{}
    @editable ElimManager : elimination_manager_device = elimination_manager_device{}
    @editable ScoreManagerDevice : score_manager_device = score_manager_device{}

    OnBegin<override>()<suspends>:void=

        ElimManager.EliminationEvent.Subscribe(OnElim)
        var PlayerScores : [agent]int = map{} # Map to keep track of player scores

    OnElim() : =
        var PlayerList:[]tuple(agent, int) = for {Agent -> Score : PlayerScores} do {Agent, Score} # Create a list of players and their scores
        set PlayerList = SortPlayerList(PlayerList) # Sort the player list by scores

        if (PlayerList1 := PlayerList[0]): # Get the first player, will fail if there isn't one.
            PlayerReference1.Register(PlayerList1(0)) # Set the first player reference

            if : PlayerList1(0) HasEffect
                return # do nothing
            else :
                Crown_VFX.pickup(PlayerList1(0))

        # Function to sort the player list by scores
    SortPlayerList(PlayerList:[]tuple(agent, int)):[]tuple(agent, int)=
        Print("Sorting Player List") # Debug print
        var NewList: []tuple(agent, int) = PlayerList
        for:
            I := 0..NewList.Length - 1 # Outer loop for bubble sort
        do:
            for:
                J := 0..NewList.Length - I - 2 # Inner loop for bubble sort
                Item := NewList[J] # Get the first player
                SecondItem := NewList[J + 1] # Get the second player
                Item(1) < SecondItem(1) # Compare the scores
            do:
                option{ set NewList[J] = SecondItem } # Swap the players
                option{ set NewList[J + 1] = Item } # Swap the players

        return NewList

```

Thank you in advance.
