setclipboard Synchronous
Clipboard.setsetrbxclipboardsyn.write_clipboardtoclipboard
Copy a value to the Android clipboard as text, ready to paste into another app. This is handy for an export code, a result, or a short diagnostic without converting it yourself first.
Luau
setclipboard(data: any) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
data | any | Value to convert to text and copy. Strings, numbers, booleans, nil, functions, threads, and values with __tostring are accepted. |
Returns
()No values.
Usage notes
Kawaii converts the value with Luau’s tostring behavior, including a table or userdata __tostring metamethod. Passing nil copies its text representation; leaving out the argument raises an error.
The copied text replaces the current clipboard contents.
Example
Luau
local result = { code = "EXAMPLE-1234" }
setmetatable(result, {
__tostring = function(self)
return self.code
end,
})
setclipboard(result)
print("Code copied to clipboard")