Skip to content

Console

Functions for creating and interacting with an external console window.

TIP

All console functions have two naming conventions: rconsole* and console* (e.g., rconsoleprint and consoleprint). Both work identically.

rconsolecreate

Creates a new console window and optionally sets its title. If a console already exists, it updates the title.

Aliases: rconsolename, rconsolesettitle, consolecreate, consolename, consolesettitle

lua
rconsolecreate(title: string?) -> void
ParameterTypeDefaultDescription
titlestring?"Console"The console window title

Example

lua
rconsolecreate("My Script Console")

rconsoleprint

Writes text to the console window. Supports color formatting using @@COLOR@@ tags.

Aliases: consoleprint

lua
rconsoleprint(text: string) -> void
ParameterTypeDescription
textstringThe text to print (supports color tags)

Color Tags

Wrap text with color tags to change the output color:

TagColor
@@BLACK@@Black
@@BLUE@@Blue
@@GREEN@@Green
@@CYAN@@Cyan
@@RED@@Red
@@MAGENTA@@Magenta
@@BROWN@@Brown
@@LIGHT_GRAY@@Light Gray
@@DARK_GRAY@@Dark Gray
@@LIGHT_BLUE@@Light Blue
@@LIGHT_GREEN@@Light Green
@@LIGHT_CYAN@@Light Cyan
@@LIGHT_RED@@Light Red
@@LIGHT_MAGENTA@@Light Magenta
@@YELLOW@@Yellow
@@WHITE@@White

Example

lua
rconsolecreate("Output")
rconsoleprint("Hello, World!\n")
rconsoleprint("@@RED@@This is red text@@WHITE@@\n")
rconsoleprint("@@GREEN@@Success! @@YELLOW@@Warning! @@RED@@Error!\n")

rconsoleinfo

Writes an informational message to the console (typically displayed in a distinct style).

Aliases: consoleinfo

lua
rconsoleinfo(text: string) -> void

Example

lua
rconsoleinfo("Script loaded successfully")

rconsolewarn

Writes a warning message to the console.

Aliases: consolewarn

lua
rconsolewarn(text: string) -> void

Example

lua
rconsolewarn("Low health detected!")

rconsoleerr

Writes an error message to the console.

Aliases: consoleerr

lua
rconsoleerr(text: string) -> void

Example

lua
rconsoleerr("Failed to load module!")

rconsoleclear

Clears all text from the console window.

Aliases: consoleclear

lua
rconsoleclear() -> void

Example

lua
rconsoleprint("This will be cleared\n")
task.wait(2)
rconsoleclear()

rconsoleinput

Waits for the user to type input into the console and press Enter. Returns the input string.

Aliases: rconsoleinputasync, consoleinput, consoleinputasync

lua
rconsoleinput() -> string

WARNING

This function yields until the user provides input.

Example

lua
rconsolecreate("Input Demo")
rconsoleprint("Enter your name: ")
local name = rconsoleinput()
rconsoleprint("Hello, " .. name .. "!\n")

rconsoledestroy

Destroys the console window.

Aliases: consoledestroy

lua
rconsoledestroy() -> void

Example

lua
rconsolecreate("Temporary Console")
rconsoleprint("Closing in 3 seconds...\n")
task.wait(3)
rconsoledestroy()