> For the complete documentation index, see [llms.txt](https://scripter-sm.gitbook.io/elite-zone/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripter-sm.gitbook.io/elite-zone/getting-started/quickstart.md).

# Quickstart

Your first Lua, from zero to loaded, in four steps.

{% stepper %}
{% step %}

### Register

The first thing every Lua does is tell the API **who it is** and **what type** it is. `register` returns your **handle** — keep it, everything else hangs off it.

```lua
local lua = api.register("Deflect Guard", "ragebot planner")
```

`type` is one of `"ragebot planner"`, `"misc"` or `"both"`.
{% endstep %}

{% step %}

### Add behaviour

Set hooks on the handle, add methods, or connect to signals. Use `lua:connect` instead of `:Connect` so it is disconnected when your Lua is replaced.

```lua
lua.can_shoot = function(target, item)
    return not api.game.is_deflecting(target.player)
end

lua:connect(game:GetService("RunService").Heartbeat, function()
    -- per-frame work
end)
```

{% endstep %}

{% step %}

### Clean up (optional)

Connections, tabs and custom methods you created through the handle are removed for you. For anything else, set `on_unload`.

```lua
lua.on_unload = function()
    print("Deflect Guard unloaded")
end
```

{% endstep %}

{% step %}

### Load it

{% tabs %}
{% tab title="From the menu" %}
Open **settings → lua** and paste the whole script into **load lua**.

Elite Zone compiles it, runs it, and — if it called `api.register` — overrides it in automatically. The label updates to `Ragebot Planner: Deflect Guard`.

{% hint style="info" %}
You don't need to call `lua:override()` yourself when loading from the menu.
{% endhint %}
{% endtab %}

{% tab title="From your executor" %}
Run the script like any other, and finish it with:

```lua
lua:override()
```

Elite Zone must already be loaded, otherwise `api` is `nil`.
{% endtab %}
{% endtabs %}
{% endstep %}
{% endstepper %}

## If something goes wrong

| Notification                    | Meaning                                                           |
| ------------------------------- | ----------------------------------------------------------------- |
| `Invalid lua: ...`              | the script didn't compile                                         |
| `Lua error: ...`                | the script errored while running                                  |
| `Lua did not register with api` | it ran, but never called `api.register`                           |
| `<name> error: ...`             | a hook or custom method errored at runtime — the Lua was unloaded |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://scripter-sm.gitbook.io/elite-zone/getting-started/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
