Page cover

broom-wideHow 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.

For Antigravity users.

  1. Go to https://antigravity.google/arrow-up-right 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

  1. Open folder with your script

  2. 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:

Last updated