VINDICTA
Misc · Function
Bunni.fun
ChocoSploit
Cryptic
Potassium
Seliware
SirHurt
Solara
Velocity
Volcano
Volt
Wave
Xeno

setclipboard

Copies text to the system clipboard.

function setclipboard(text: string): ()

Synopsis

How it works

Copies the given string to the system clipboard using the Win32 clipboard API:
OpenClipboard(NULL);
EmptyClipboard();
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, size);
memcpy(GlobalLock(hMem), text, size);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
The text is immediately available for pasting (Ctrl+V) in any application. The CF_UNICODETEXT format stores the string as UTF-16LE, so the executor converts from Lua’s UTF-8UTF-8A variable-width character encoding that represents Unicode text. ASCII characters use 1 byte; others use 2-4 bytes. Lua strings are raw byte sequences — Luau uses UTF-8 for string display. strings before calling SetClipboardData. The clipboard takes ownership of the allocated memory — do not free hMem.

Usage

Copy player position
local cf = game.Players.LocalPlayer.Character.PrimaryPart.CFrame
setclipboard(tostring(cf))

Parameters

text string
The text to copy.
Alias
Also available as toclipboard.