Skip to main content
Opens a Windows message-box popup and returns the code of the button the user clicked.
text is the popup body, caption is the title bar, and flags is a number that packs three things at once: the button set in the low 4 bits, an icon, and which button starts selected. The value passes straight to Win32’s MessageBoxA, so the codes below come from Microsoft’s docs. Most commonly used to ask the user to confirm before a script does something they can’t undo.
Calling messagebox freezes the entire Roblox client until the user dismisses the popup. Visuals don’t redraw, input doesn’t register, and no Luau coroutine runs while it’s open.
Common button styles (low 4 bits, mutually exclusive):
  • 0 - MB_OK: just OK
  • 1 - MB_OKCANCEL: OK and Cancel
  • 3 - MB_YESNOCANCEL: Yes, No, and Cancel
  • 4 - MB_YESNO: Yes and No
Icon bits (added to the button style for a coloured icon next to the text):
  • 0x10 - red error
  • 0x20 - question mark (deprecated by Microsoft but still works)
  • 0x30 - yellow warning triangle
  • 0x40 - blue info (i)
flags = 4 + 0x30 opens a Yes/No popup with the warning icon. Default-button selectors (0x100, 0x200, 0x300) and rarer button sets (Abort/Retry/Ignore, Cancel/TryAgain/Continue) live in the Microsoft docs.
Learn more here.

Parameters

Returns

number - the Win32 ID constant for the button the user clicked:

Example

Calling messagebox freezes the entire Roblox client until the user dismisses the popup. Visuals don’t redraw, input doesn’t register, and no Luau coroutine runs while it’s open.