# ServerRpc

The server RPC allows logic to be ran on the server from a client - by default it will not require any ownership - so can be run by any player. This wont run on the client who called it unless `RunLocally` is `true`.

{% code fullWidth="false" %}

```typescript
import { AirshipNetworkBehaviour, ServerRpc } from "@Easy/Core/Shared/Network";

export default class ExampleGlobalButton extends AirshipNetworkBehaviour {
    // This will send a button press message to the server _only_
    @ServerRpc()
    public PressButton(player: Player, message: string) {
        // Player argument necessary if not requiring ownership
        print("The player", player, "pressed the button with their message", message);
    }
}
```

{% endcode %}

{% hint style="info" %}
Note: If you want to restrict to only the network owner of the component, you must specify `RequiresOwnership`as `true`

<pre class="language-typescript" data-full-width="true"><code class="lang-typescript">import { AirshipNetworkBehaviour, ServerRpc } from "@Easy/Core/Shared/Network";
<strong>export default class ExamplePlayerInventory extends AirshipNetworkBehaviour {
</strong>    @ServerRpc({ RequiresOwnership: true })
    public DropItemFromInventory(itemId: ItemType, amount: number) {
        // Note: No player argument as this is guaranteed to be the owner
    }
}
</code></pre>

{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.airship.gg/networking/airshipnetworkbehaviour/serverrpc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
