MessageBox: Close Synchronous
Close the message box from your script. The callback receives "ForceClosed" unless a choice was already made.
Luau
MessageBox:Close() -> ()Parameters
Call this method with a MessageBox receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
This function takes no arguments.
Returns
()No values.
Usage notes
Closing again, or closing after the box timed out, does nothing and does not run the callback a second time.
Example
Luau
local box = MessageBox.new({Text = "Waiting for the server...", Buttons = {"Cancel"}, Yield = false})
box:OnChoice(function(choice)
print("Box closed:", choice)
end)
box:Show()
task.wait(3)
box:Close() -- prints "Box closed: ForceClosed" if the user has not answered