Skip to main content

RxCharacterUtils

Utilities for observing characters and their humanoids.

Functions

observeLastCharacterBrio

RxCharacterUtils.observeLastCharacterBrio(playerPlayer) → Observable<Brio<Model>>

Observe a player's last character.

observeCharacter

RxCharacterUtils.observeCharacter(playerPlayer) → Observable<Model>

Observes a player's character property

observeLastHumanoidBrio

RxCharacterUtils.observeLastHumanoidBrio(playerPlayer) → Observable<Brio<Humanoid>>

Observe a player's last humanoid. Note that it may not be alive!

observeLastAliveHumanoidBrio

RxCharacterUtils.observeLastAliveHumanoidBrio(playerPlayer) → Observable<Brio<Humanoid>>

Observes a player's last living humanoid.

local Players = game:GetService("Players")

maid:GiveTask(
	RxCharacterUtils.observeLastAliveHumanoidBrio(Players.LocalPlayer)
		:Subscribe(function(humanoidBrio)
			local humanoid: Humanoid = humanoidBrio:GetValue()
			local humanoidMaid = humanoidBrio:ToMaid()

			print("Humanoid:", humanoid)

			humanoidMaid:GiveTask(function()
				-- The maid cleans up on humanoid death, or when given player leaves the game.
				print("Humanoid has been killed or destroyed!")
			end)
		end)
)
Show raw api
{
    "functions": [
        {
            "name": "observeLastCharacterBrio",
            "desc": "Observe a player's last character.",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<Model>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 25,
                "path": "src/characterutils/src/Shared/RxCharacterUtils.lua"
            }
        },
        {
            "name": "observeCharacter",
            "desc": "Observes a player's character property",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Model>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 39,
                "path": "src/characterutils/src/Shared/RxCharacterUtils.lua"
            }
        },
        {
            "name": "observeLastHumanoidBrio",
            "desc": "Observe a player's last humanoid. Note that it may not be alive!",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<Humanoid>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "src/characterutils/src/Shared/RxCharacterUtils.lua"
            }
        },
        {
            "name": "observeLastAliveHumanoidBrio",
            "desc": "Observes a player's last living humanoid.\n\n```lua\nlocal Players = game:GetService(\"Players\")\n\nmaid:GiveTask(\n\tRxCharacterUtils.observeLastAliveHumanoidBrio(Players.LocalPlayer)\n\t\t:Subscribe(function(humanoidBrio)\n\t\t\tlocal humanoid: Humanoid = humanoidBrio:GetValue()\n\t\t\tlocal humanoidMaid = humanoidBrio:ToMaid()\n\n\t\t\tprint(\"Humanoid:\", humanoid)\n\n\t\t\thumanoidMaid:GiveTask(function()\n\t\t\t\t-- The maid cleans up on humanoid death, or when given player leaves the game.\n\t\t\t\tprint(\"Humanoid has been killed or destroyed!\")\n\t\t\tend)\n\t\tend)\n)\n```",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<Humanoid>>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 160,
                "path": "src/characterutils/src/Shared/RxCharacterUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "RxCharacterUtils",
    "desc": "Utilities for observing characters and their humanoids.",
    "source": {
        "line": 5,
        "path": "src/characterutils/src/Shared/RxCharacterUtils.lua"
    }
}