Generate random bytes with crypt.generatebytes
crypt-generate-bytesGenerate cryptographically random bytes in-game for tokens or keys; returns a Base64 string with optional size, and reports an error if executor support is missing.
Instructions
Generate size cryptographically random bytes using the executor's crypt.generatebytes(size). The bytes are returned as a Base64 string (decode with crypt-base64-decode if you need the raw bytes). This is a pure, side-effect-free compute that runs entirely in-game. The default size is 16; the request is clamped to a sane 1..1024 range. Requires crypt.generatebytes; on an executor without it, it returns { error } instead of throwing. The call is pcall-guarded. Returns { bytes } or { error }. Signature: { size: any?, threadContext: number?, timeoutMs: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client. Produces: structured-result. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | Number of random bytes to generate (default 16, clamped to 1..1024). | |
| timeoutMs | No | Optional per-call deadline in milliseconds; omit it to use the tool or server default. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |