setclipboard
Copies a value's string representation to the system clipboard.
Syntax
setclipboard(data: any) -> ()Aliases
toclipboard
Parameters
| Parameter | Type | Description |
|---|---|---|
data | any | The value to convert to a string and copy |
Returns
This function does not return a value.
Description
setclipboard calls tostring on the value and copies the result.
Example
-- Copy a simple message
setclipboard("Hello, World!")
-- Copy player information
local player = game.Players.LocalPlayer
setclipboard(player.Name .. " - " .. player.UserId)
-- Copy a table as JSON
local HttpService = game:GetService("HttpService")
local data = {name = "Player", score = 100}
setclipboard(HttpService:JSONEncode(data))Notes
- Tables are not automatically JSON-encoded; encode structured data explicitly when needed
Related Functions
identifyexecutor- Get executor info