DocsLua scripting
Commands
Add your own commands to the server console.
lua
RegisterCommand('heal', function(source, args, raw)
-- source = 0 (the server console)
-- args = { 'arg1', 'arg2', ... } as strings
-- raw = the whole line, e.g. "heal 5"
local id = tonumber(args[1])
if not id then print('Usage: heal <id>') return end
SendMessage(id, 'You have been healed.')
end)- Commands are run from the server console (or with
ExecuteCommand). Players can't run them directly - make a net event for player commands. - The name can't contain spaces and can't be the same as an Unreal Engine command.
RegisterCommandreturnstrueorfalse. - Registering the same name again replaces the old handler.
#Run a console command from Lua
lua
ExecuteCommand('res.restart chat')Last updated 2026-12-06