messagebox

Shows a native message box.

Syntax

Signature
messagebox(Text: string, Title: string, Flags: number?) -> (number?, string?)

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
TextstringMessage shown in the dialog.
TitlestringDialog title.
Flagsnumber?Windows-style button, icon, and default-button flags. Defaults to 0 for OK.

Returns

TypeDescription
number?Selected button code, or nil while inactive.
string?Error message when the dialog could not be shown.

Notes

Text and Title must be valid UTF-8 without NUL bytes and each may contain up to 1 MiB. Returns nil and an error message when the game window is inactive.

Button codes are 1 for OK, 2 for Cancel, 3 for Abort, 4 for Retry, 5 for Ignore, 6 for Yes, 7 for No, 10 for Try Again, and 11 for Continue.

Example

Luau
local Choice = messagebox("Continue?", "Script", 1)
print(Choice)