> For the complete documentation index, see [llms.txt](https://faq.unlocknow.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faq.unlocknow.net/how-to-clean-scripts.md).

# How to clean scripts

#### What does it even mean to "**clean the script**?"

This means that the script was dumped using a special technique that has one drawback. It does not extract the full LUA code, only its bytecode. It is functional, but may cause errors; so you need to fix it using AI.

#### What would I need?

1. AI Coding **App** (Antigravity, windsurf, cursor or similar)
2. Special AI **Prompt**

```
Objective: Refactor Lua (FiveM) scripts in each currently opened folder while maintaining 100% of the original functionality, but with: ✅ Descriptive names (no L0_1, A0_2, etc. Unless it is a global variable from outside this lua file that requires keeping the name of the var) ✅ Organized structure (dedicated functions, simplified logic) ✅ Zero unnecessary comments (only where critical) ✅ Full compatibility (preserve global variables used in other files)
Function pattern:
Don't use local functions - always use direct functions
For callbacks/handlers: use anonymous functions directly:
lua

RegisterCommand("antilag", function(source, args, rawCommand)
-- code here
end)
For normal functions: create a function and then assign it if necessary: lua
function ToggleAntilag()
-- code here
end
Don't change:
Registered events (RegisterNetEvent, AddEventHandler)
Global table names (cfg, p_flame_location, etc.)
Global variables used across files
Improve:
Replace L0_1, A0_2 with names like currentGear, flameActive
Extract repetitive blocks into dedicated functions
Use pairs to iterate through data when appropriate
Flag when: ⚠️ Unsure about the purpose of a code block ⚠️ Encountering mysterious global variables (e.g., L1_1 = _ENV[...]) ⚠️ Need me to explain the logic of a snippet 
```

## How do I clean the script? Step by step.&#x20;

#### For Antigravity users.

1. Go to <https://antigravity.google/> and create your account.
2. Set up your app and **log-in** using Google Account
3. After logging-in select: **Fast** & **Claude Opus 4.5**

<div align="left"><figure><img src="/files/s2ShcWXrwIAdDcT8j1Lh" alt="" width="535"><figcaption></figcaption></figure></div>

4. Open **folder** with your script
5. Paste the **prompt** from the top of the page and start

What should I know?

* If you reach your usage limit, **switch accounts**.
* Once the AI has finished cleaning, minor errors may appear. Ask **Antigravity** to fix them.
* If you don't **understand** how to use it:

{% embed url="<https://www.youtube.com/watch?v=TWpy7v_DK9k>" %}


---

# 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 dynamically by asking a question.

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

```
GET https://faq.unlocknow.net/how-to-clean-scripts.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.
