Skip to main content

effect_utils

utility

this module contains effect utils that are used by the effects manager. those utils are responsible for managing and applying effects to players.

the effects that can be applied are:

  • speed boost
  • jump boost

Types

effect

interface effect {
effectstring--

the name of the effect.

changenumber--

the amount of change the effect will apply.

lifetimenumber--

the time, in seconds, the effect will last.

startnumber--

the timestamp of when the most recent time the effect was applied.

}

represents an active effect that the player has.

Functions

get

effect_utils.get(
playerPlayer--

the player to get effects for.

) → {effect}--

the effects for the player.

get all effects for a player.

give

effect_utils.give(
playerPlayer,--

the player to give the effect to.

effect_namestring,--

the name of the effect to give.

changenumber,--

the amount of change the effect will apply.

lifetimenumber?--

the time, in seconds, the effect will last.

) → ()

give an effect to a player.

remove

effect_utils.remove(
playerPlayer,--

the player to remove the effect from.

effect_namestring--

the name of the effect to remove.

) → ()

remove an effect from a player.

clear

effect_utils.clear(
playerPlayer--

the player to clear the effects for.

) → ()

remove all effects for a player.

step

This item only works when running on the client. Client
effect_utils.step() → {effect}--

the effects that were active and applied.

step all effects for the current player.

Show raw api
{
    "functions": [
        {
            "name": "get",
            "desc": "get all effects for a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to get effects for.",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "the effects for the player.",
                    "lua_type": "{ effect }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 57,
                "path": "src/shared/utils/effects.luau"
            }
        },
        {
            "name": "give",
            "desc": "give an effect to a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to give the effect to.",
                    "lua_type": "Player"
                },
                {
                    "name": "effect_name",
                    "desc": "the name of the effect to give.",
                    "lua_type": "string"
                },
                {
                    "name": "change",
                    "desc": "the amount of change the effect will apply.",
                    "lua_type": "number"
                },
                {
                    "name": "lifetime",
                    "desc": "the time, in seconds, the effect will last.",
                    "lua_type": "number?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 74,
                "path": "src/shared/utils/effects.luau"
            }
        },
        {
            "name": "remove",
            "desc": "remove an effect from a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to remove the effect from.",
                    "lua_type": "Player"
                },
                {
                    "name": "effect_name",
                    "desc": "the name of the effect to remove.",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 94,
                "path": "src/shared/utils/effects.luau"
            }
        },
        {
            "name": "clear",
            "desc": "remove all effects for a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "the player to clear the effects for.",
                    "lua_type": "Player"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 112,
                "path": "src/shared/utils/effects.luau"
            }
        },
        {
            "name": "step",
            "desc": "step all effects for the current player.",
            "params": [],
            "returns": [
                {
                    "desc": "the effects that were active and applied.",
                    "lua_type": "{ effect }"
                }
            ],
            "function_type": "static",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 125,
                "path": "src/shared/utils/effects.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "effect",
            "desc": "represents an active effect that the player has.",
            "fields": [
                {
                    "name": "effect",
                    "lua_type": "string",
                    "desc": "the name of the effect."
                },
                {
                    "name": "change",
                    "lua_type": "number",
                    "desc": "the amount of change the effect will apply."
                },
                {
                    "name": "lifetime",
                    "lua_type": "number",
                    "desc": "the time, in seconds, the effect will last."
                },
                {
                    "name": "start",
                    "lua_type": "number",
                    "desc": "the timestamp of when the most recent time the effect was applied."
                }
            ],
            "source": {
                "line": 16,
                "path": "src/shared/utils/effects.luau"
            }
        }
    ],
    "name": "effect_utils",
    "desc": "this module contains effect utils that are used by the *effects manager*. those utils are responsible for *managing* and *applying* effects to players.\n\nthe effects that can be applied are:\n- speed boost\n- jump boost",
    "tags": [
        "utility"
    ],
    "source": {
        "line": 46,
        "path": "src/shared/utils/effects.luau"
    }
}