execute_command

Runs a Luau snippet in Studio and returns the output.

What it does

execute_command is the escape hatch when the other tools do not cover what Revix needs. The snippet runs in Studio's plugin context with full access to the DataModel. Anything printed with print() is captured and returned, and if the snippet uses return, the return value is included too.

By convention this tool is used for read-only inspection — checking a property, counting children, verifying that a service or instance exists, computing a derived value. Destructive operations through execute_command are discouraged because they sidestep the structured tools (set_properties, delete_instance) that the rest of Revix is built around, and they make the action history harder to read and undo cleanly.

Parameters

NameTypeRequiredDescription
`code`stringyesLuau code to execute in Studio.

When Revix uses it

  • Reading a derived value (#workspace:GetChildren(), distance between two parts)
  • Checking whether a specific instance or service exists before acting
  • Running a small calculation that needs live game state
  • Diagnosing a problem that is not covered by get_properties or list_descendants

Example

lua
-- Count parts in workspace
print("Parts:", #workspace:GetChildren())

-- Check whether the Events folder exists
return game:GetService("ReplicatedStorage"):FindFirstChild("Events") ~= nil

Limits

Read-only by convention. Avoid running destructive operations through execute_command — use set_properties, delete_instance, move_instance, or edit_script instead so the action is wrapped in a proper undo waypoint.

Troubleshooting

If a command times out or errors, the snippet may be blocking or referencing instances that do not exist. See troubleshooting.