# Instance Functions

This page contains a list of all instance functions used by Powerlang. Instance functions are called like `instance:FunctionName(functionArgs)`.

| Name                                                                                         | Description                                                                                              |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `MakeJoints()`                                                                               | Creates joints between connected parts in a model.                                                       |
| `BreakJoints()`                                                                              | Breaks all the joints connected to the parts in a model.                                                 |
| `SetNetworkOwner(player: Player?)`                                                           | Sets the network owner of the part to a specific player.                                                 |
| `IsTouching(part: BasePart) -> bool`                                                         | Returns true if the part is currently touching another part.                                             |
| `GetTouchingParts() -> table<BasePart>`                                                      | Returns a table of parts currently touching the part.                                                    |
| `GetConnectedParts() -> table<BasePart>`                                                     | Returns a table of parts physically connected to the part.                                               |
| `SetPartPhysicalProperties(Elasticity, Friction, Density, ElasticityWeight, FrictionWeight)` | Sets the physical properties of the part, like density or friction.                                      |
| `GetPartPhysicalProperties() -> PhysicalProperties`                                          | Gets the current physical properties of the part.                                                        |
| `FireRocketPropulsion()`                                                                     | Fires the rocket propulsion towards a target.                                                            |
| `AbortRocketPropulsion()`                                                                    | Stops the rocket propulsion.                                                                             |
| `AssignCollisionGroup(groupName: string)`                                                    | Assigns the part to a specific collision group.                                                          |
| `MoveModelTo(position: Vector3)`                                                             | Moves a model to a specific position.                                                                    |
| `SetModelPrimaryPartCFrame(cframe: CFrame)`                                                  | Sets the CFrame of the primary part of the model.                                                        |
| `GetModelBoundingBox() -> (CFrame, Vector3)`                                                 | Returns the CFrame and size of the model's bounding box.                                                 |
| `PlaySound()`                                                                                | Plays a sound instance.                                                                                  |
| `StopSound()`                                                                                | Stops a sound instance.                                                                                  |
| `PauseSound()`                                                                               | Pauses a sound instance.                                                                                 |
| `ResumeSound()`                                                                              | Resumes a paused sound instance.                                                                         |
| `TextBoxCaptureFocus()`                                                                      | Captures the keyboard focus on a text box.                                                               |
| `TextBoxReleaseFocus()`                                                                      | Releases the keyboard focus from a text box.                                                             |
| `GetPlayersOnTeam(team: Team) -> table<Player>`                                              | Returns a table of players on the specified team.                                                        |
| `TeleportToPlace(placeId: int)`                                                              | Teleports the player to a specified place and spawn point.                                               |
| `KickPlayer(reason: string?)`                                                                | Kicks the player from the game with an optional reason.                                                  |
| `GetPlayerFromCharacter(character: Model) -> Player?`                                        | Returns the player associated with the given character model.                                            |
| `HasBadge(badgeId: int) -> bool`                                                             | Checks if a player has a specific badge.                                                                 |
| `GiveBadge(badgeId: int)`                                                                    | Awards a badge to a player.                                                                              |
| `HasGamepass(gamepassId: int) -> bool`                                                       | Checks if a player owns a specific game pass.                                                            |
| `MutePlayer()`                                                                               | Mutes a player in the game.                                                                              |
| `BanPlayer()`                                                                                | Bans a player from the game.                                                                             |
| `CheckToolEquipped() -> bool`                                                                | Returns true if the player has the specified tool equipped.                                              |
| `TakeDamage(amount: number)`                                                                 | Applies damage to a humanoid.                                                                            |
| `HumanoidMoveTo(position: Vector3)`                                                          | Moves the humanoid to a specific position or part.                                                       |
| `ChangeHumanoidState(state: HumanoidStateType)`                                              | Changes the humanoid's state to a specific state.                                                        |
| `GetHumanoidState() -> HumanoidStateType`                                                    | Gets the current state of the humanoid.                                                                  |
| `TeleportPlayerToPosition(position: Vector3)`                                                | Teleports the player to a specific position.                                                             |
| `LoadCharacter()`                                                                            | Reloads the player's character.                                                                          |
| `GetPartDirection() -> Vector3`                                                              | Returns the direction the part is facing as a `Vector3`.                                                 |
| `DisconnectEvent()`                                                                          | Disconnects an event connection.                                                                         |
| `IsConnected() -> bool`                                                                      | Returns true if the event connection is still active.                                                    |
| `Clone() -> Instance`                                                                        | Creates a copy of the instance.                                                                          |
| `Destroy()`                                                                                  | Permanently removes the instance from the game.                                                          |
| `FindFirstChild(childName: string, recursive: bool) -> Instance?`                            | Finds the first child with a given name in an instance. If `recursive` is true, it searches descendants. |
| `FindFirstChildOfClass(className: string) -> Instance?`                                      | Finds the first child with a given class name in an instance.                                            |
| `FindFirstChildWhichIsA(className: string) -> Instance?`                                     | Finds the first child that is of a specific class.                                                       |
| `GetChildren() -> table<Instance>`                                                           | Returns a table of all the direct children of the instance.                                              |
| `GetDescendants() -> table<Instance>`                                                        | Returns a table of all descendants of the instance.                                                      |
| `IsA(className: string) -> bool`                                                             | Returns true if the instance is of the given class or inherits from it.                                  |
| `IsAncestorOf(descendant: Instance) -> bool`                                                 | Returns true if the instance is an ancestor of the given descendant.                                     |
| `IsDescendantOf(ancestor: Instance) -> bool`                                                 | Returns true if the instance is a descendant of the given ancestor.                                      |
| `WaitForChild(childName: string, timeout: number?) -> Instance?`                             | Waits for a child with the given name to be added, or returns `nil` if it times out.                     |
| `FireServer(...)`                                                                            | Sends a remote event to the server from the client.                                                      |
| `FireClient(player: Player, ...)`                                                            | Sends a remote event to a specific player from the server.                                               |
| `Fire(...)`                                                                                  | Fires a custom signal event.                                                                             |
| `Invoke(...) -> any`                                                                         | Calls a custom function and returns the result.                                                          |
| `InvokeServer(...) -> any`                                                                   | Invokes a remote function on the server from the client and returns the result.                          |
| `InvokeClient(player: Player, ...) -> any`                                                   | Invokes a remote function on a specific player from the server and returns the result.                   |
