How do i use a verse code on only one player? Instead of all players

This is my invis card code. but how do i put it in only one class in the game. i dont want everyone to be able use this card.

fill this file with your verse-script

some of these are not needed, but too many is better than not enough

#Bazoo Studios LLC
#http://www.BazooStudios.com for more!
using {/Fortnite.com/Devices}
using {/Fortnite.com/UI}
using {/Fortnite.com/Game}
using {/Fortnite.com/Characters}
using {/Fortnite.com/Playspaces}
using {/Verse.org/Simulation}
using {/Verse.org/Random}
using {/UnrealEngine.com/Temporary/Diagnostics}
using {/UnrealEngine.com/Temporary/UI}
using {/UnrealEngine.com/Temporary/SpatialMath}

Define a class named InvisibleBehavior that inherits from the creative_device class.

InvisibleBehavior := class(creative_device):

# BELOW IS CARD INVIS STUFF ----------

# Declare a conditional_button_device named CardDetector as an editable attribute.
@editable
CardDetector:conditional_button_device = conditional_button_device{}

@editable
PlayerClass:class_designer_device = class_designer_device{}

# Define an overridden OnBegin method that is called when the game starts.
OnBegin<override>()<suspends>:void=
    spawn:
        # Call the CheckForCard method when the game begins.
        CheckForCard()

# Define a method to check if a card is being held by any player.
CheckForCard()<suspends>:void=
     loop:
        # Pause for 0.5 seconds.
        Sleep(0.5)
        
        # Get all players in the playspace.
        AllPlayers:=GetPlayspace().GetPlayers()
        
        # Iterate through each player.
        for(Player:AllPlayers):
            
            # Check if the player is an agent.
            if(IsAgent:agent = agent[Player]):
                
                # Check if the CardDetector is holding an item for the agent.
                if(CardDetector.IsHoldingItem[IsAgent]): # decide inside brackets []
                    
                    # If holding a card, hide the player.
                    HidePlayer(IsAgent)
                else:
                    
                    # If not holding a card, show the player.
                    ShowPlayer(IsAgent)

# Define a method to show a player by displaying their FortCharacter.
ShowPlayer(Agent:agent):void=
    if(FC:=Agent.GetFortCharacter[]):
        FC.Show()  # Show the FortCharacter.

# Define a method to hide a player by hiding their FortCharacter.
HidePlayer(Agent:agent)<suspends>:void=
    if(FC:=Agent.GetFortCharacter[]):
        FC.Hide()  # Hide the FortCharacter.

Preformatted text

In the CheckForCard Function you get allplayers then interate through each player

this is where you need to check that the player your checking is the player that you need. then only run the rest of the function on that player only

Im not good at coding. Can you modify the code for me?

i’m not gonna write it for you. just think of the hours of forums searching and head scratching then finally finding the anwser I dont want to be the one to deprive you of that… :stuck_out_tongue:

seriously though this is how you learn

having read the code again it looks like the function has virually been written
there is a comment in your code almost like this is an assignment task?

                # Check if the CardDetector is holding an item for the agent.
                if(CardDetector.IsHoldingItem[IsAgent]): # decide inside brackets []

I’m assuming you get a card when you press the card detector button
use the event of the button to set a variable “hasCard” then in the section with the bracket check weather “hasCard” is true or false