How To Check If A Player Is On A Specific Team?

Here is my code:


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


# A Verse-authored creative device that can be placed in a level
Power_Device := class(creative_device):

    @editable
    Speedster : player_spawner_device = player_spawner_device{}
    @editable
    Ninja : player_spawner_device = player_spawner_device{}
    @editable
    Jumpster : player_spawner_device = player_spawner_device{}

    

    

    var InvisibilityState : int = 0
    Crouched(Inplayer:agent) : void =
        if (InvisibilityState <> 1):
            Print("Invisible")
            set InvisibilityState = 1
        else:
            Print("Visible")
            set InvisibilityState = 0

    CLASSCHECK(InAgent:agent) : void =
        var SpeedsterTeam : ?team = option{GetPlayspace().GetTeamCollection().GetTeams()[2]}
        var NinjaTeam : ?team = option{GetPlayspace().GetTeamCollection().GetTeams()[1]}
        var JumpsterTeam : ?team = option{GetPlayspace().GetTeamCollection().GetTeams()[0]}
        
        if(PTeam := GetPlayspace().GetTeamCollection().GetTeam[InAgent]):
            if (PTeam = SpeedsterTeam):
                Print("Speedster")
            else if (PTeam = NinjaTeam):
                Print("Ninja")
            else if(PTeam = JumpsterTeam):
                Print("Jumpster")

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        
        Print("Initialised")
        Speedster.SpawnedEvent.Subscribe(CLASSCHECK)
        Jumpster.SpawnedEvent.Subscribe(CLASSCHECK)
        Ninja.SpawnedEvent.Subscribe(CLASSCHECK)
        

As you can see in the CLASSCHECK Method, I want to check which team a player is on, and then run the corresponding code. I’ve tried so many methods, none of which worked, I’m starting to think this isn’t even possible!