Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Apr 25, 2023
1 parent 488d767 commit 8abd1d9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/observeCharacter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

local observePlayer = require(script.Parent.observePlayer)

--[=[
@within Observers
Creates an observer that captures each character in the game.
```lua
observeCharacter(function(player, character)
print("Character spawned for " .. player.Name)
return function()
-- Cleanup
print("Character removed for " .. player.Name)
end
end)
```
]=]
local function observeCharacter(callback: (player: Player, character: Model) -> (() -> ())?): () -> ()
return observePlayer(function(player)
local cleanupFn: (() -> ())? = nil
Expand Down

0 comments on commit 8abd1d9

Please sign in to comment.