Skip to main content

players_utils

std

this module provides utilities for working with players.

Functions

from_hit

players_utils.from_hit(
hitBasePart--

the hit to check.

) → Player?--

the player that was hit. this can also return nil if no player was hit.

get a player from a basepart.

get_player

This item only works when running on the client. Client
players_utils.get_player() → Player?--

the local player. this returns nil if the player is not found or if it's called on the server.

gets the local player.

get_character

players_utils.get_character(
playerPlayer--

the player to get the character of.

) → Model?--

the character of the player. this can also return nil if no character was found.

gets the character of a player.

get_humanoid

players_utils.get_humanoid(
playerPlayer--

the player to get the character of.

) → Humanoid?--

the humanoid of the player. this can also return nil if the player is nil or the humanoid was not found.

gets the character of a player.

Show raw api
{
    "functions": [
        {
            "name": "from_hit",
            "desc": "get a player from a basepart.",
            "params": [
                {
                    "name": "hit",
                    "desc": "the hit to check.",
                    "lua_type": "BasePart"
                }
            ],
            "returns": [
                {
                    "desc": "the player that was hit. this can also return nil if no player was hit.",
                    "lua_type": "Player?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "src/shared/kit/std/players.luau"
            }
        },
        {
            "name": "get_player",
            "desc": "gets the local player.",
            "params": [],
            "returns": [
                {
                    "desc": "the local player. this returns nil if the player is not found or if it's called on the server.",
                    "lua_type": "Player?"
                }
            ],
            "function_type": "static",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 47,
                "path": "src/shared/kit/std/players.luau"
            }
        },
        {
            "name": "get_character",
            "desc": "gets the character of a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to get the character of.",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "the character of the player. this can also return nil if no character was found.",
                    "lua_type": "Model?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 66,
                "path": "src/shared/kit/std/players.luau"
            }
        },
        {
            "name": "get_humanoid",
            "desc": "gets the character of a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to get the character of.",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "the humanoid of the player. this can also return nil if the player is nil or the humanoid was not found.",
                    "lua_type": "Humanoid?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 85,
                "path": "src/shared/kit/std/players.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "players_utils",
    "desc": "this module provides utilities for *working with players*.",
    "tags": [
        "std"
    ],
    "source": {
        "line": 13,
        "path": "src/shared/kit/std/players.luau"
    }
}