Custom Player System Module Guide

In your game, you can utilize the custom player system provided by the Sys module script. This module script offers a range of functions to manage player interactions, from handling money and items to health and experience points. Below, you’ll find a list of functions along with their descriptions and usage examples.

How to Use:

  1. Insert the Sys module script into your game’s ServerStorage

  2. Require the module script in your server scripts using:

    local ServerStorage= game:GetService("ServerStorage")
    local Sys = require(ServerStorage:WaitForChild("Sys"))
    

Functions and Usage:

  1. Sys:givePlayerMoney(player: Player, Cash: number, waitT: boolean)

    Description: This function gives money to a player, with an optional wait period.

    • player (Player): The player to whom you want to give money.
    • Cash (number): The amount of money to add to the player’s account.
    • waitT (boolean): If true, the player will be added to a waitlist for a certain duration before the money is added. If false, the money will be added immediately.

    Example:

    Sys:givePlayerMoney(player, 1000, true)
    -- Adds 1000 money to the player's account and adds the player to a waitlist for 8 seconds.
    
  2. Sys:takePlayerMoney(player: Player, Cash: number)

    Description: This function deducts money from a player’s account.

    • player (Player): The player from whom you want to deduct money.
    • Cash (number): The amount of money to deduct from the player’s account.

    Example:

    Sys:takePlayerMoney(player, 500)
    -- Deducts 500 money from the player's account.
    
  3. Sys:isPlayer(source: Instance, returnType: string)

    Description: This function checks if the given source is a player and provides specific information based on the returnType.

    • source (Instance): The source instance to check.
    • returnType (string): The type of information to return. Possible values: “img” (Player and image), “char” (Player character), “all” (Player, character, and image), “cp” (Player and character).

    Example:

    local player, character, image = Sys:isPlayer(someSource, "all")
    -- Returns the player, their character, and their thumbnail image.
    
  4. Sys:getPlayerCash(player: Player)

    Description: This function retrieves the current amount of cash for a player.

    • player (Player): The player whose cash you want to retrieve.

    Returns: The current cash value of the player.

    Example:

    local cashAmount = Sys:getPlayerCash(player)
    print("Current cash: " .. cashAmount)
    
  5. Sys:setPlayerCash(player: Player, newCash: number)

    Description: This function sets the player’s cash to a new value.

    • player (Player): The player whose cash you want to set.
    • newCash (number): The new cash value to set for the player.

    Example:

    Sys:setPlayerCash(player, 1500)
    -- Sets the player's cash to 1500.
    
  6. Sys:givePlayerItems(player: Player, items: Instance)

    Description: This function gives items to a player by adding them to the player’s backpack.

    • player (Player): The player to whom you want to give items.
    • items (Instance): The items you want to give to the player.

    Example:

    local sword = game.ReplicatedStorage:FindFirstChild("Sword")
    Sys:givePlayerItems(player, sword)
    -- Gives the player a sword item.
    
  7. Sys:sendMessageToPlayer(player: Player, message: string)

    Description: This function sends a message to a player using notifications.

    • player (Player): The player to whom you want to send the message.
    • message (string): The message you want to send.

    Example:

    Sys:sendMessageToPlayer(player, "Hello there!")
    -- Sends "Hello there!" message to the player.
    
  8. Sys:givePlayerXP(player: Player, amount: number)

    Description: This function gives experience points (XP) to a player.

    • player (Player): The player to whom you want to give XP.
    • amount (number): The amount of XP to give to the player.

    Example:

    Sys:givePlayerXP(player, 50)
    -- Adds 50 experience points to the player's account.
    
  9. Sys:givePlayerHealth(player: Player, amount: number)

    Description: This function increases the player’s health by a specified amount.

    • player (Player): The player whose health you want to increase.
    • amount (number): The amount by which you want to increase the player’s health.

    Example:

    Sys:givePlayerHealth(player, 10)
    -- Increases the player's health by 10.
    
  10. Sys:takePlayerXP(player: Player, amount: number)

    Description: This function deducts experience points (XP) from a player.

    • player (Player): The player from whom you want to deduct XP.
    • amount (number): The amount of XP to deduct from the player.

    Example:

    Sys:takePlayerXP(player, 25)
    -- Deducts 25 experience points from the player's account.
    
  11. Sys:takePlayerItems(player: Player, items: string)

    Description: This function removes an item from the player’s backpack.

    • player (Player): The player from whom you want to remove the item.
    • items (string): The name of the item you want to remove.

    Example:

    Sys:takePlayerItems(player, "Sword")
    -- Removes the "Sword" item from the player's backpack.
    
  12. Sys:TakeDamage(Character: Model, Mush: number)

    Description: This function inflicts damage to a character’s health.

    • Character (Model): The character model to damage.
    • Mush (number): The amount of damage to inflict.

    Example:

    Sys:TakeDamage(characterModel, 10)
    -- Reduces the character's health by 10.
    
  13. Sys:teleportPlayer(player: Player, targetPosition: Vector3)

    Description: This function teleports a player to a specific position.

    • player (Player): The player to teleport.
    • targetPosition (Vector3): The target position to teleport the player to.

    Example:

    local targetPosition = Vector3.new(0, 10, 0)
    Sys:teleportPlayer(player, targetPosition)
    -- Teleports the player to position (0, 10, 0).
    

Feel free to customize and expand this guide to match the features and functions of your game’s player system. Developers can refer to this guide to effectively integrate and utilize the Sys module script in their game projects.

If you edit it, don’t forget to share it with us : )

3 Likes

Was this meant for #resources:community-resources? Ask the mods to change it for you.

1 Like

yes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.