Player Checker Module

Overview

The PlayerChecker module provides functionality to check if a player has specific items equipped or in their backpack. This is particularly useful for conditionally allowing certain actions based on the player's inventory, such as toggling the visibility of the RELICSxyz Player.


Data Structures

  • allowedItems: A list of item names that grant the player permission to toggle the RELICSxyz Player. This list can be customized to include any items you wish to check for.


Functions

  • itemIsAllowed(itemName: string)

    • Description: Checks if a given item name is in the list of allowed items.

    • Parameters:

      • itemName (string): The name of the item to check.

    • Returns: true if the item is in the allowed list, otherwise false.

  • hasAllowedItem(player: Player)

    • Description: Checks if a player has any of the allowed items either equipped or in their backpack.

    • Parameters:

      • player (Player): The player instance to check.

    • Returns: true if the player has an allowed item, otherwise false.

  • CanToggleVisibility(player: Player)

    • Description: Determines if a player can toggle the visibility of the RELICSxyz Player based on their inventory.

    • Parameters:

      • player (Player): The player instance to check.

    • Returns: true if the player can toggle the visibility, otherwise false.


Usage

To use the PlayerChecker module in another script:


Notes

  • Ensure that the allowedItems list in the PlayerChecker module is updated to reflect the specific items you want to check for in your game.

  • The module checks both the player's character (equipped items) and their backpack.

Last updated