How can I make an "OnPlayerAdded" Function ?

Hi everyone, I am working on my first game, but I ran into an issue. I’m struggling with verse and making very slow progress, yet, I still want to learn so having the most details is always great. I already tried adding an OnPlayerAdded function but I seem to struggle a lot. What I’m trying to do is create a script where there’s an UI for Killstreak missions, but only 2 players are registered in the code, the only players that were there during game start. So, when a player leaves and a new player joins, this new player won’t be registered and thus, the kills won’t count towards the killstreak.
This is my script:

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

CustPlayer := class():
MyAgentObj:agent

var Score : int = 0
var Goal : int = 0
var ReliableAgentIndex : [agent]int = map{}
var UnusedAgentIndexes : []int = array{}

SetScore(S:int):void=
    set Score = S

GetScore():int=
    return Score

SetGoal(G:int):void=
    set Goal = G

GetGoal():int=
    return Goal

goal := struct:

@editable
Name_of_the_item : string = "Gold pump shotgun"

@editable
Kills : int = 2

@editable
Reward : item_granter_device = item_granter_device{} 

location_image := struct:

@editable
X : float = 0.008511

@editable
Y : float = 0.5

location_text := struct:

@editable
X : float = -0.252674

@editable
Y : float = 0.503322

mission_device := class(creative_device):

var PlayersMap:[agent]CustPlayer=map{}

var PlayerWidgetsMap : [player]PlayerWT = map{}

@editable
Trigger : trigger_device = trigger_device{}

@editable
Goals : []goal = array{}

@editable
Image_Location : location_image = location_image{}

@editable
Text_Location : location_text = location_text{}

OnBegin<override>()<suspends>:void=
    AllPlayers := GetPlayspace().GetParticipants()
       if (FirstGoal := Goals[0]):
        Text := FirstGoal.Name_of_the_item
        Mission := FirstGoal.Kills
        for (Player : AllPlayers):
            OnStart(Player)
            if (FC := Player.GetFortCharacter[]):
                FC.EliminatedEvent().Subscribe(OnElimination)
                Self.GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded)

OnStart(Agent: agent):void=
    if(PlayerExists := PlayersMap[Agent]):
    else:
        CP:CustPlayer = CustPlayer{MyAgentObj:= Agent}
        if:
            set PlayersMap[Agent] = CP

 NewClassGame := MainMissions{}
 NewClassGameCanvas := NewClassGame.CreateUI(Text_Location.X, Text_Location.Y, Image_Location.X, Image_Location.Y)
    PlayerWidgets := PlayerWT:
        NewMiniGame := NewClassGameCanvas
        MainGame := NewClassGame
    if(Player := player[Agent], set PlayerWidgetsMap [Player] = PlayerWidgets, PlayerUI := GetPlayerUI[Player]):
        PlayerUI.AddWidget(NewClassGameCanvas)
    if (Text := Goals[0].Name_of_the_item, Mission :=  Goals[0].Kills):
        if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
            Widgets.MainGame.UpdateGameUI(Agent, 0, Text, Mission, 0, false)

OnPlayerAdded(Player :player):void=
    PlayerAdded :=Player.PlayerAdded

OnElimination(ElimRes :elimination_result):void=
    DeadOwner := ElimRes.EliminatedCharacter
    if (Agent := DeadOwner.GetAgent[]):
        if (CP:CustPlayer = PlayersMap[Agent]):
            CP.SetScore(0)
            MyScore := CP.GetScore()
            CP.SetGoal(0)
        if (Text := Goals[0].Name_of_the_item, Mission :=  Goals[0].Kills):
            if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
                Widgets.MainGame.UpdateGameUI(Agent, 0, Text, Mission, 0, false)

    Killer := ElimRes.EliminatingCharacter
    var end : logic = false
    if (Agent := Killer?.GetAgent[]):
        if (CP:CustPlayer = PlayersMap[Agent]):
            CurScore := CP.GetScore()
            ScoreToSet := CurScore + 1
            CP.SetScore(ScoreToSet)
            Goal := CP.GetGoal()
            if (CurGoal := Goals[Goal]):
                Mission := CurGoal.Kills
                if (ScoreToSet = Mission):
                    CurGoal.Reward.GrantItem(Agent)
                    NewGoal := Goal + 1
                    CP.SetGoal(NewGoal)
                    if (NwMission := Goals[NewGoal]):
                        TotalGoals := Goals.Length
                        if (NewGoal = TotalGoals):
                            Print("End 1")
                            set end = true
                            Text := NwMission.Name_of_the_item
                            Trigger.Trigger(Agent)
                            if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
                                Widgets.MainGame.UpdateGameUI(Agent, NewGoal, Text, Mission, ScoreToSet, end)
                        else:
                            Text := NwMission.Name_of_the_item
                            NewMission := NwMission.Kills
                            if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
                                Widgets.MainGame.UpdateGameUI(Agent, NewGoal, Text, NewMission, ScoreToSet, end)
                    else:
                        Print("End 2")
                        set end = true
                        Trigger.Trigger(Agent)
                            Text := "nothing"
                            if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
                                Widgets.MainGame.UpdateGameUI(Agent, NewGoal, Text, Mission, ScoreToSet, end)
                else:
                    Text := CurGoal.Name_of_the_item
                    NewMission := CurGoal.Kills
                    if (Player := player[Agent], Widgets := PlayerWidgetsMap[Player]):
                        Widgets.MainGame.UpdateGameUI(Agent, Goal, Text, NewMission, ScoreToSet, end)

S2M(S:string):message = “{S}”

MainMissions := class():
var MainCanvas : canvas = canvas{}
var MissionImage : texture_block = texture_block{DefaultImage:= Missions.Snipe, DefaultDesiredSize := vector2{X:=496.0,Y:=447.0}}
var MissionGoal : text_block = text_block{DefaultTextColor:=White}
var Images : MissionImages = MissionImages{}

UpdateGameUI(Agent:agent, Goal:int, Text:string, Mission:int, TheCurScore:int, end:logic):void=
        if (TheImage := Images.GoalImages[Goal]):
            if (end = true):
                MissionGoal.SetText(S2M("Congratulations!\nYou have finished \nall the missions"))
                MissionImage.SetImage(TheImage)
            else:
                MissionGoal.SetText(S2M("{Text}\nGet {Mission} Eliminations\n                  {TheCurScore}/{Mission}"))
                MissionImage.SetImage(TheImage)

CreateUI(TextX : float, TextY : float, ImageX : float, ImageY : float):canvas =
    NewCanvas : canvas = canvas{
        Slots := array:
            canvas_slot:
                Anchors := anchors{Minimum := vector2{X:=0.0, Y:=0.351111}, Maximum := vector2{X:=0.0, Y:=0.351111}}
                Offsets := margin{Left:=0.0, Top:= 0.0, Right := 0.0, Bottom:= 0.0}
                Alignment := vector2{X:=ImageX, Y:=ImageY}
                ZOrder := 0
                SizeToContent := true
                Widget := MissionImage
        
            canvas_slot:
                Anchors := anchors{Minimum := vector2{X:=0.0, Y:=0.351111}, Maximum := vector2{X:=0.0, Y:=0.351111}}
                Offsets := margin{Left:= 0.0, Top:= 0.0, Right := 0.0, Bottom:= 0.0}
                Alignment := vector2{X:=TextX, Y:=TextY}
                ZOrder := 1
                SizeToContent := true
                Widget := MissionGoal
    }

MissionImages := class:
GoalImages:texture = array:
Missions.Snipe
Missions.Drum
Missions.Titanesque
Missions.Peter
Missions.Dub
Missions.Explosive
Missions.GreenCheckMark

PlayerWT := struct:
NewMiniGame : canvas
MainGame : MainMissions

use the Player Spawners SpawnedEvent instead of GetPlayspace().PlayerAddedEvent()