@@ -26,7 +26,7 @@ interface Observers {
2626 observeAttribute : (
2727 instance : Instance ,
2828 name : string ,
29- callback : ( value : AttributeValue ) => ( ) => void ,
29+ callback : ( value : AttributeValue ) => ( ( ) => void ) | void ,
3030 guard ?: ( value : AttributeValue ) => boolean ,
3131 ) => ( ) => void ;
3232
@@ -53,7 +53,7 @@ interface Observers {
5353 observeProperty : < T extends Instance , P extends InstancePropertyNames < T > > (
5454 instance : T ,
5555 property : P ,
56- callback : ( value : T [ P ] ) => ( ) => void ,
56+ callback : ( value : T [ P ] ) => ( ( ) => void ) | void ,
5757 ) => ( ) => void ;
5858
5959 /**
@@ -99,7 +99,7 @@ interface Observers {
9999 observePlayer : ( callback : ( player : Player ) => ( ( exitReason : Enum . PlayerExitReason ) => void ) | void ) => ( ) => void ;
100100
101101 /**
102- * Observers characters in the game.
102+ * Observers characters in the game. An optional list of `allowedPlayers` can be provided. Otherwise, characters from all players are observed.
103103 *
104104 * ```ts
105105 * Observers.observeCharacter((player, character) => {
@@ -130,7 +130,25 @@ interface Observers {
130130 */
131131 observeCharacter : < C extends Model = Model > (
132132 callback : ( player : Player , character : C ) => ( ( ) => void ) | void ,
133+ allowedPlayers ?: Player [ ] ,
133134 ) => ( ) => void ;
135+
136+ /**
137+ * Observers the local character in the game. This can only be called from the client.
138+ *
139+ * ```ts
140+ * observeLocalCharacter((character) => {
141+ * print("Local character added");
142+ * return () => {
143+ * print("Local character removed");
144+ * };
145+ * });
146+ * ```
147+ *
148+ * @param callback Observer called for the local character. Optional cleanup function can be returned, which is called when the character is removed.
149+ * @returns Cleanup function, which stops observing the local character.
150+ */
151+ observeLocalCharacter : < C extends Model = Model > ( callback : ( character : C ) => ( ( ) => void ) | void ) => ( ) => void ;
134152}
135153
136154declare const Observers : Observers ;
0 commit comments