Getting started
How to write a script in game, share it with a code, and install someone else's.
Writing a script
Scripts are written in game. Open the menu, go to the Scripts tab and press New script. The editor opens with a small example you can change or replace.
local m = module {
name = 'Auto Sprint',
category = 'movement',
}
m:on('tick', function()
player.setSprinting(true)
end)Two things worth noticing. The module is not enabled by default; you switch it on in the menu like any other. And the tick callback only runs while it is on, so there is no if enabled check to write.
module{} is what shows in the module list and the key your settings are saved under. It has to be a plain string, name = 'Auto Sprint', not a variable, and it cannot be the name of a module you already have. Renaming it later resets that module's settings for everyone who has it.The editor
It works like any code editor: click to place the cursor, drag or Shift with the arrow keys to select, and double-click a word to select it. Ctrl+Z undoes and Ctrl+Y redoes, Ctrl+C, Ctrl+X and Ctrl+V use the clipboard, and Tab and Shift+Tab indent and unindent the selected lines.
To change a script later, open its card in the Scripts tab and press Edit Script.
Saving and errors
Press Save or Ctrl+S. The script is checked before it is saved: if it would not load, nothing is saved, the line with the problem is marked red, the cursor jumps to it, and the message is shown at the bottom of the editor.
A script that passes is saved to your account and replaces the running copy at once. If its module was switched on, it stays on. Anything kept in a local variable starts fresh, so state that has to survive a save belongs in a setting.
m:on('tick', ...) twice leaves you with the second handler, not both. That is what makes saving and toggling safe: a module switched on and off twenty times still has exactly one tick handler.Installing a shared script
In the Scripts tab, press Import, paste the code and press Enter. You see the script's name and author before anything is installed; press Enter again or click it to install. It then sits in the module list like any other module, takes a keybind, and its settings are saved into your config.
A script is code someone else wrote. Only install one from someone you trust, and read the sandbox page for what a script can and cannot do. Remove Script on its card takes it off your account.
Your library is the only source
Scripts come from your account's library and from nowhere else: the ones you wrote and the ones you installed. There is no scripts folder, and no way to add one by hand. The refresh button in the Scripts tab fetches your library again.
When it breaks while running
An error in a callback is reported in a banner at the top of the screen, with the line number, and marked in the editor if it is open. It is not fatal: an error in one callback does not stop the others or affect any other script. Nothing is ever written to chat.
A script that errors three times within ten seconds switches itself off. This is almost always a per-frame callback with a typo in it, which would otherwise produce one error per frame and bury everything else. Fix it, save, and switch it back on.
One of your scripts that cannot load at all is listed under Did not load at the top of the Scripts tab, so you can open it and fix it.
For your own diagnostics, print(...) and client.print(...) both show a FluxWare notification only you can see.
Adding settings
Settings are declared in the script body and render as the client's own widgets: the same sliders, dropdowns and colour pickers as any built-in module, saved into the same config.
local m = module { name = 'Auto Sprint', category = 'movement' }
local onlyOnGround = m:setting('boolean', 'Only on ground', true)
local mode = m:setting('mode', 'Mode', { 'Always', 'Moving' }, 'Always')
m:on('tick', function()
if onlyOnGround:get() and not player.isOnGround() then return end
if mode:get() == 'Moving' then
local x, y, z = player.velocity()
if math.abs(x) + math.abs(z) < 0.01 then return end
end
player.setSprinting(true)
end)Every setting handle has :get() and :set(value). The full list of kinds is on the module{} page.