# Table of Contents - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) - [Volt Documentation](#volt-documentation) --- # Volt Documentation RakNet ====== The **RakNet** library provides low-level access to outgoing game packets. Interacting with RakNet is unsafe and can lead to account terminations, broken game behavior, disconnects, or other unintended side effects. Do not use this library unless you understand the risks and know exactly what you are doing. [Overview](https://docs.volt.bz/docs/raknet#overview) ------------------------------------------------------ RakNet allows you to: * Inspect outgoing packets before they are sent * Modify or block packets in a send hook * Send custom packet payloads manually * Work with packet data as a buffer, string, or byte array [Functions](https://docs.volt.bz/docs/raknet#functions) -------------------------------------------------------- | Function | Description | | --- | --- | | `raknet.add_send_hook` | Register a callback that runs before a packet is sent | | `raknet.remove_send_hook` | Remove a callback registered with `raknet.add_send_hook` | | `raknet.send` | Send a packet with a payload, priority, reliability, and ordering channel | [Packet API](https://docs.volt.bz/docs/raknet#packet-api) ---------------------------------------------------------- ### [Methods](https://docs.volt.bz/docs/raknet#methods) | Method | Description | | --- | --- | | `RakNetPacket:SetData` | Replace the packet payload | | `RakNetPacket:Block` | Prevent the packet from being sent | ### [Properties](https://docs.volt.bz/docs/raknet#properties) | Property | Type | Description | | --- | --- | --- | | `RakNetPacket.AsBuffer` | `buffer` | Packet data as a buffer | | `RakNetPacket.AsString` | `string` | Packet data as a string | | `RakNetPacket.AsArray` | `{number}` | Packet data as an array of bytes | | `RakNetPacket.Priority` | `number` | Packet priority | | `RakNetPacket.Reliability` | `number` | Packet reliability | | `RakNetPacket.OrderingChannel` | `number` | Packet ordering channel | | `RakNetPacket.Size` | `number` | Packet payload size in bytes | [Hook Syntax](https://docs.volt.bz/docs/raknet#hook-syntax) ------------------------------------------------------------ raknet.add_send_hook(hook: (packet: RakNetPacket) -> ()) -> () raknet.remove_send_hook(hook: (packet: RakNetPacket) -> ()) -> () [Send Syntax](https://docs.volt.bz/docs/raknet#send-syntax) ------------------------------------------------------------ raknet.send( data: buffer | string | {number}, priority: number, reliability: number, ordering_channel: number ) -> () [Packet Method Syntax](https://docs.volt.bz/docs/raknet#packet-method-syntax) ------------------------------------------------------------------------------ RakNetPacket:SetData(data: buffer | string | {number}) -> () RakNetPacket:Block() -> () [Parameters](https://docs.volt.bz/docs/raknet#parameters) ---------------------------------------------------------- ### [`raknet.add_send_hook`](https://docs.volt.bz/docs/raknet#raknetadd_send_hook) | Parameter | Type | Description | | --- | --- | --- | | `hook` | `(packet: RakNetPacket) -> ()` | Callback fired before a packet is sent | ### [`raknet.remove_send_hook`](https://docs.volt.bz/docs/raknet#raknetremove_send_hook) | Parameter | Type | Description | | --- | --- | --- | | `hook` | `(packet: RakNetPacket) -> ()` | Previously registered send hook | ### [`raknet.send`](https://docs.volt.bz/docs/raknet#raknetsend) | Parameter | Type | Description | | --- | --- | --- | | `data` | \`buffer | string | | `priority` | `number` | RakNet send priority | | `reliability` | `number` | RakNet reliability mode | | `ordering_channel` | `number` | Ordering channel used for ordered traffic | ### [`RakNetPacket:SetData`](https://docs.volt.bz/docs/raknet#raknetpacketsetdata) | Parameter | Type | Description | | --- | --- | --- | | `data` | \`buffer | string | [Returns](https://docs.volt.bz/docs/raknet#returns) ---------------------------------------------------- All `raknet` functions and `RakNetPacket` methods documented here do not return a value. [Description](https://docs.volt.bz/docs/raknet#description) ------------------------------------------------------------ `raknet.add_send_hook` lets you intercept outgoing packets before they are sent. Inside a hook, you can inspect packet metadata, read its payload in multiple formats, replace the payload with `RakNetPacket:SetData`, or stop transmission entirely with `RakNetPacket:Block`. `raknet.send` sends a custom packet payload using the provided priority, reliability, and ordering channel. Payload data may be supplied as a `buffer`, a `string`, or an array of byte values. Because this library operates at the packet level, mistakes can be difficult to debug and may have immediate consequences. Keep hooks minimal, validate payloads carefully, and avoid modifying traffic unless absolutely necessary. [Example: Logging Outgoing Packets](https://docs.volt.bz/docs/raknet#example-logging-outgoing-packets) ------------------------------------------------------------------------------------------------------- local function packetLogger(packet) print("Outgoing packet:") print(" Size:", packet.Size) print(" Priority:", packet.Priority) print(" Reliability:", packet.Reliability) print(" Ordering channel:", packet.OrderingChannel) end raknet.add_send_hook(packetLogger) [Example: Blocking a Packet](https://docs.volt.bz/docs/raknet#example-blocking-a-packet) ----------------------------------------------------------------------------------------- local function blockLargePackets(packet) if packet.Size > 512 then warn("Blocked packet larger than 512 bytes") packet:Block() end end raknet.add_send_hook(blockLargePackets) [Example: Replacing Packet Data](https://docs.volt.bz/docs/raknet#example-replacing-packet-data) ------------------------------------------------------------------------------------------------- local function rewritePacket(packet) local bytes = packet.AsArray if #bytes > 0 then bytes[1] = 0x01 packet:SetData(bytes) end end raknet.add_send_hook(rewritePacket) [Example: Sending a Packet](https://docs.volt.bz/docs/raknet#example-sending-a-packet) --------------------------------------------------------------------------------------- local payload = { 0x01, 0x02, 0x03, 0x04 } raknet.send(payload, 0, 0, 0) [Notes](https://docs.volt.bz/docs/raknet#notes) ------------------------------------------------ * Hooks run before the packet is sent * `RakNetPacket:Block()` prevents the current packet from being transmitted * `RakNetPacket:SetData()` replaces the packet payload in-place * Packet data can be read and written as a `buffer`, `string`, or byte array * Invalid payloads or incorrect metadata can disconnect clients or break protocol behavior [oth.unhook\ \ Previous Page](https://docs.volt.bz/docs/oth/unhook) [Reflection\ \ Next Page](https://docs.volt.bz/docs/reflection) ### On this page [Overview](https://docs.volt.bz/docs/raknet#overview) [Functions](https://docs.volt.bz/docs/raknet#functions) [Packet API](https://docs.volt.bz/docs/raknet#packet-api) [Methods](https://docs.volt.bz/docs/raknet#methods) [Properties](https://docs.volt.bz/docs/raknet#properties) [Hook Syntax](https://docs.volt.bz/docs/raknet#hook-syntax) [Send Syntax](https://docs.volt.bz/docs/raknet#send-syntax) [Packet Method Syntax](https://docs.volt.bz/docs/raknet#packet-method-syntax) [Parameters](https://docs.volt.bz/docs/raknet#parameters) [`raknet.add_send_hook`](https://docs.volt.bz/docs/raknet#raknetadd_send_hook) [`raknet.remove_send_hook`](https://docs.volt.bz/docs/raknet#raknetremove_send_hook) [`raknet.send`](https://docs.volt.bz/docs/raknet#raknetsend) [`RakNetPacket:SetData`](https://docs.volt.bz/docs/raknet#raknetpacketsetdata) [Returns](https://docs.volt.bz/docs/raknet#returns) [Description](https://docs.volt.bz/docs/raknet#description) [Example: Logging Outgoing Packets](https://docs.volt.bz/docs/raknet#example-logging-outgoing-packets) [Example: Blocking a Packet](https://docs.volt.bz/docs/raknet#example-blocking-a-packet) [Example: Replacing Packet Data](https://docs.volt.bz/docs/raknet#example-replacing-packet-data) [Example: Sending a Packet](https://docs.volt.bz/docs/raknet#example-sending-a-packet) [Notes](https://docs.volt.bz/docs/raknet#notes) --- # Volt Documentation Introduction ============ The official documentation for **Volt** The environment docs are heavily based on the [sUNC](https://sunc.su/) (senS' Unified Naming Convention) standard. Here you can find information about Volt's scripting environment and other general usage information. This documentation is subject to refactoring and may not remain exactly the same * * * [📚 Explore the Docs](https://docs.volt.bz/docs#-explore-the-docs) ------------------------------------------------------------------- [### Closures\ \ Inspect, modify and create Luau closures with precise control.](https://docs.volt.bz/docs/closures) [### Debug\ \ Access debug library functions for runtime inspection.](https://docs.volt.bz/docs/debug) [### Drawing\ \ Create and manage drawing objects for visual overlays.](https://docs.volt.bz/docs/drawing) [### Encoding\ \ Encode and decode data in various formats.](https://docs.volt.bz/docs/encoding) [### Environment\ \ Access and manipulate the Lua environment.](https://docs.volt.bz/docs/environment) [### Filesystem\ \ Read, write, and manage files on the local system.](https://docs.volt.bz/docs/filesystem) [### Instances\ \ Interact with Roblox instances in special ways.](https://docs.volt.bz/docs/instances) [### Metatable\ \ Work with metatables and metamethods.](https://docs.volt.bz/docs/metatable) [### Miscellaneous\ \ Various utility functions.](https://docs.volt.bz/docs/miscellaneous) [### oth\ \ Secure thread-based function hooking for C functions.](https://docs.volt.bz/docs/oth) [### Reflection\ \ Access hidden properties and thread identity.](https://docs.volt.bz/docs/reflection) [### RakNet\ \ Inspect, modify, block, and send low-level game packets.](https://docs.volt.bz/docs/raknet) [### Scripts\ \ Interact with running scripts and modules.](https://docs.volt.bz/docs/scripts) [### Signals\ \ Fire and manage Roblox signals.](https://docs.volt.bz/docs/signals) [### VoltSignal\ \ Custom signal implementation for events.](https://docs.volt.bz/docs/voltsignal) [### LuaStateProxy\ \ Proxy object for Lua execution states.](https://docs.volt.bz/docs/luastateproxy) [### WebSocket\ \ Create WebSocket connections for real-time communication.](https://docs.volt.bz/docs/websocket) [Actors\ \ Next Page](https://docs.volt.bz/docs/actors) ### On this page [📚 Explore the Docs](https://docs.volt.bz/docs#-explore-the-docs) --- # Volt Documentation Cache ===== The **Cache** library provides functions for manipulating the instance reference cache. [Overview](https://docs.volt.bz/docs/cache#overview) ----------------------------------------------------- These functions allow you to: * Replace cached instance references * Invalidate cached references * Check if an instance is cached [Available Functions](https://docs.volt.bz/docs/cache#available-functions) --------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`cache.replace`](https://docs.volt.bz/docs/cache/replace) | Replace a cached instance reference | | [`cache.invalidate`](https://docs.volt.bz/docs/cache/invalidate) | Remove an instance from the cache | | [`cache.iscached`](https://docs.volt.bz/docs/cache/iscached) | Check if an instance is cached | [Related Functions](https://docs.volt.bz/docs/cache#related-functions) ----------------------------------------------------------------------- | Function | Description | | --- | --- | | [`cloneref`](https://docs.volt.bz/docs/instances/cloneref) | Clone an instance reference | | [`compareinstances`](https://docs.volt.bz/docs/instances/compareinstances) | Compare two instance references | [run\_on\_actor\ \ Previous Page](https://docs.volt.bz/docs/actors/run_on_actor) [cache.invalidate\ \ Next Page](https://docs.volt.bz/docs/cache/invalidate) ### On this page [Overview](https://docs.volt.bz/docs/cache#overview) [Available Functions](https://docs.volt.bz/docs/cache#available-functions) [Related Functions](https://docs.volt.bz/docs/cache#related-functions) --- # Volt Documentation [oth](https://docs.volt.bz/docs/oth) oth.unhook ========== Removes a hook created with `oth.hook`. [Syntax](https://docs.volt.bz/docs/oth/unhook#syntax) ------------------------------------------------------ oth.unhook(target: function) -> boolean [Parameters](https://docs.volt.bz/docs/oth/unhook#parameters) -------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `target` | `function` | The hooked function to remove | [Returns](https://docs.volt.bz/docs/oth/unhook#returns) -------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if the hook was successfully removed | [Description](https://docs.volt.bz/docs/oth/unhook#description) ---------------------------------------------------------------- `oth.unhook` removes a hook from a function that was created with `oth.hook`. The function is restored to its original behavior. [Example](https://docs.volt.bz/docs/oth/unhook#example) -------------------------------------------------------- -- Hook a function local originalFunc = oth.hook(someCFunction, function(...) print("Hooked:", ...) return originalFunc(...) end) -- Later, remove the hook local success = oth.unhook(someCFunction) if success then print("Hook removed successfully") end [Check Hook Status](https://docs.volt.bz/docs/oth/unhook#check-hook-status) ---------------------------------------------------------------------------- local originalFunc = oth.hook(print, function(...) print("[HOOKED]", ...) end) -- Remove hook if oth.unhook(print) then print("Hook removed") else print("No hook to remove") end [Notes](https://docs.volt.bz/docs/oth/unhook#notes) ---------------------------------------------------- * Only works on functions hooked with `oth.hook` * Returns `false` if the function wasn't hooked or hook removal failed * The original function reference from `oth.hook` remains valid after unhooking [Related Functions](https://docs.volt.bz/docs/oth/unhook#related-functions) ---------------------------------------------------------------------------- * [`oth.hook`](https://docs.volt.bz/docs/oth/hook) - Create a hook * [`oth.get_root_callback`](https://docs.volt.bz/docs/oth/get_root_callback) - Get original function [oth.is\_hook\_thread\ \ Previous Page](https://docs.volt.bz/docs/oth/is_hook_thread) [RakNet\ \ Next Page](https://docs.volt.bz/docs/raknet) ### On this page [Syntax](https://docs.volt.bz/docs/oth/unhook#syntax) [Parameters](https://docs.volt.bz/docs/oth/unhook#parameters) [Returns](https://docs.volt.bz/docs/oth/unhook#returns) [Description](https://docs.volt.bz/docs/oth/unhook#description) [Example](https://docs.volt.bz/docs/oth/unhook#example) [Check Hook Status](https://docs.volt.bz/docs/oth/unhook#check-hook-status) [Notes](https://docs.volt.bz/docs/oth/unhook#notes) [Related Functions](https://docs.volt.bz/docs/oth/unhook#related-functions) --- # Volt Documentation oth === The **oth** library provides secure alternatives to `hookfunction` for C functions. Hooks are executed on separate threads, providing better isolation and safety. [Overview](https://docs.volt.bz/docs/oth#overview) --------------------------------------------------- The `oth` library allows you to: * Hook C functions securely on separate threads * Remove hooks when no longer needed * Access the original function even after multiple hooks * Detect if code is running in a hook thread [Available Functions](https://docs.volt.bz/docs/oth#available-functions) ------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`oth.hook`](https://docs.volt.bz/docs/oth/hook) | Hook a C function on a separate thread | | [`oth.unhook`](https://docs.volt.bz/docs/oth/unhook) | Remove a hook created with `oth.hook` | | [`oth.get_root_callback`](https://docs.volt.bz/docs/oth/get_root_callback) | Get the original function | | [`oth.is_hook_thread`](https://docs.volt.bz/docs/oth/is_hook_thread) | Check if running in a hook thread | | [`get_original_thread`](https://docs.volt.bz/docs/oth/get_original_thread) | Get the original thread | [Why Use oth?](https://docs.volt.bz/docs/oth#why-use-oth) ---------------------------------------------------------- Unlike `hookfunction`, `oth.hook` executes hooks on separate threads, providing: * **Better isolation** - Hooks don't interfere with the main thread * **Improved safety** - Reduces risk of crashes from hook conflicts * **Thread awareness** - Know when you're in a hook context [Related Libraries](https://docs.volt.bz/docs/oth#related-libraries) --------------------------------------------------------------------- * [`closures`](https://docs.volt.bz/docs/closures) - Standard function hooking with `hookfunction` [setfpscap\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/setfpscap) [get\_original\_thread\ \ Next Page](https://docs.volt.bz/docs/oth/get_original_thread) ### On this page [Overview](https://docs.volt.bz/docs/oth#overview) [Available Functions](https://docs.volt.bz/docs/oth#available-functions) [Why Use oth?](https://docs.volt.bz/docs/oth#why-use-oth) [Related Libraries](https://docs.volt.bz/docs/oth#related-libraries) --- # Volt Documentation Encoding ======== The **Encoding** library provides functions for encoding and decoding data in various formats. [Overview](https://docs.volt.bz/docs/encoding#overview) -------------------------------------------------------- These functions allow you to: * Convert data to and from Base64 * Compress and decompress data using LZ4 [Available Functions](https://docs.volt.bz/docs/encoding#available-functions) ------------------------------------------------------------------------------ | Function | Description | | --- | --- | | [`base64decode`](https://docs.volt.bz/docs/encoding/base64decode) | Decode a Base64 string | | [`base64encode`](https://docs.volt.bz/docs/encoding/base64encode) | Encode data to Base64 | | [`lz4compress`](https://docs.volt.bz/docs/encoding/lz4compress) | Compress data using LZ4 | | [`lz4decompress`](https://docs.volt.bz/docs/encoding/lz4decompress) | Decompress LZ4 data | [setrenderproperty\ \ Previous Page](https://docs.volt.bz/docs/drawing/setrenderproperty) [base64decode\ \ Next Page](https://docs.volt.bz/docs/encoding/base64decode) ### On this page [Overview](https://docs.volt.bz/docs/encoding#overview) [Available Functions](https://docs.volt.bz/docs/encoding#available-functions) --- # Volt Documentation Drawing ======= The **Drawing** library provides functions for creating and managing visual overlays that render on top of the Roblox viewport. [Overview](https://docs.volt.bz/docs/drawing#overview) ------------------------------------------------------- Drawing objects allow you to create: * Lines and shapes * Text labels * Images * Custom UI elements These drawings are rendered directly on the screen and are not part of the Roblox UI system, making them hidden from game scripts. [Available Functions](https://docs.volt.bz/docs/drawing#available-functions) ----------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`cleardrawcache`](https://docs.volt.bz/docs/drawing/cleardrawcache) | Clear all cached drawing objects | | [`getrenderproperty`](https://docs.volt.bz/docs/drawing/getrenderproperty) | Get a property from a drawing object | | [`isrenderobj`](https://docs.volt.bz/docs/drawing/isrenderobj) | Check if a value is a drawing object | | [`setrenderproperty`](https://docs.volt.bz/docs/drawing/setrenderproperty) | Set a property on a drawing object | [Creating Drawing Objects](https://docs.volt.bz/docs/drawing#creating-drawing-objects) --------------------------------------------------------------------------------------- Use `Drawing.new(type)` to create new drawing objects: local line = Drawing.new("Line") line.From = Vector2.new(0, 0) line.To = Vector2.new(100, 100) line.Color = Color3.fromRGB(255, 0, 0) line.Thickness = 2 line.Visible = true [Drawing Types](https://docs.volt.bz/docs/drawing#drawing-types) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `Line` | A line between two points | | `Circle` | A circle with center and radius | | `Square` | A rectangle | | `Triangle` | A triangle with three vertices | | `Text` | Text label | | `Image` | An image/texture | | `Quad` | A quadrilateral with four vertices | [Common Properties](https://docs.volt.bz/docs/drawing#common-properties) ------------------------------------------------------------------------- All drawing objects share these properties: | Property | Type | Description | | --- | --- | --- | | `Visible` | `boolean` | Whether the object is visible | | `ZIndex` | `number` | Rendering order (higher = on top) | | `Transparency` | `number` | Transparency (0 = opaque, 1 = invisible) | | `Color` | `Color3` | The object's color | [Cleanup](https://docs.volt.bz/docs/drawing#cleanup) ----------------------------------------------------- Always remove drawing objects when done: local circle = Drawing.new("Circle") -- ... use the circle ... circle:Remove() [debug.validlevel\ \ Previous Page](https://docs.volt.bz/docs/debug/validlevel) [cleardrawcache\ \ Next Page](https://docs.volt.bz/docs/drawing/cleardrawcache) ### On this page [Overview](https://docs.volt.bz/docs/drawing#overview) [Available Functions](https://docs.volt.bz/docs/drawing#available-functions) [Creating Drawing Objects](https://docs.volt.bz/docs/drawing#creating-drawing-objects) [Drawing Types](https://docs.volt.bz/docs/drawing#drawing-types) [Common Properties](https://docs.volt.bz/docs/drawing#common-properties) [Cleanup](https://docs.volt.bz/docs/drawing#cleanup) --- # Volt Documentation WebSocket ========= The **WebSocket** library provides functions for creating WebSocket connections for real-time bidirectional communication. [Overview](https://docs.volt.bz/docs/websocket#overview) --------------------------------------------------------- WebSockets allow you to: * Establish persistent connections to servers * Send and receive messages in real-time [Constructor](https://docs.volt.bz/docs/websocket#constructor) --------------------------------------------------------------- | Function | Description | | --- | --- | | [`WebSocket.connect`](https://docs.volt.bz/docs/websocket/connect) | Create a new WebSocket connection | [Properties](https://docs.volt.bz/docs/websocket#properties) ------------------------------------------------------------- | Property | Type | Description | | --- | --- | --- | | [`OnMessage`](https://docs.volt.bz/docs/websocket/onmessage) | `Signal` | Fired when a message is received | | [`OnClose`](https://docs.volt.bz/docs/websocket/onclose) | `Signal` | Fired when the connection closes | [Methods](https://docs.volt.bz/docs/websocket#methods) ------------------------------------------------------- | Method | Description | | --- | --- | | [`WebSocket:Send`](https://docs.volt.bz/docs/websocket/send) | Send a string message | | [`WebSocket:Close`](https://docs.volt.bz/docs/websocket/close) | Close the connection | [VoltSignal:Wait\ \ Previous Page](https://docs.volt.bz/docs/voltsignal/wait) [WebSocket:Close\ \ Next Page](https://docs.volt.bz/docs/websocket/close) ### On this page [Overview](https://docs.volt.bz/docs/websocket#overview) [Constructor](https://docs.volt.bz/docs/websocket#constructor) [Properties](https://docs.volt.bz/docs/websocket#properties) [Methods](https://docs.volt.bz/docs/websocket#methods) --- # Volt Documentation Environment =========== The **Environment** library provides functions for accessing and manipulating the Lua environment, including garbage collection inspection and global environments. [Overview](https://docs.volt.bz/docs/environment#overview) ----------------------------------------------------------- These functions allow you to: * Access different global environments * Inspect the garbage collector * Filter and find objects in memory [Available Functions](https://docs.volt.bz/docs/environment#available-functions) --------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`filtergc`](https://docs.volt.bz/docs/environment/filtergc) | Filter garbage collected objects | | [`getgc`](https://docs.volt.bz/docs/environment/getgc) | Get all objects tracked by garbage collector | | [`getgenv`](https://docs.volt.bz/docs/environment/getgenv) | Get volt's global environment | | [`getreg`](https://docs.volt.bz/docs/environment/getreg) | Get the Lua registry | | [`getrenv`](https://docs.volt.bz/docs/environment/getrenv) | Get the game's global environment | | [`gettenv`](https://docs.volt.bz/docs/environment/gettenv) | Get a thread's environment | [Environment Types](https://docs.volt.bz/docs/environment#environment-types) ----------------------------------------------------------------------------- ### [Volt Environment (genv)](https://docs.volt.bz/docs/environment#volt-environment-genv) The global environment where your scripts run. Variables defined here persist across script executions. ### [Game Environment (renv)](https://docs.volt.bz/docs/environment#game-environment-renv) The game's Lua environment containing Roblox globals like `game`, `workspace`, etc. ### [Registry](https://docs.volt.bz/docs/environment#registry) The Lua registry is a special table used internally by the Lua implementation to store references. [lz4decompress\ \ Previous Page](https://docs.volt.bz/docs/encoding/lz4decompress) [filtergc\ \ Next Page](https://docs.volt.bz/docs/environment/filtergc) ### On this page [Overview](https://docs.volt.bz/docs/environment#overview) [Available Functions](https://docs.volt.bz/docs/environment#available-functions) [Environment Types](https://docs.volt.bz/docs/environment#environment-types) [Volt Environment (genv)](https://docs.volt.bz/docs/environment#volt-environment-genv) [Game Environment (renv)](https://docs.volt.bz/docs/environment#game-environment-renv) [Registry](https://docs.volt.bz/docs/environment#registry) --- # Volt Documentation VoltSignal ========== The **VoltSignal** library provides a custom signal implementation for creating and managing events. [Overview](https://docs.volt.bz/docs/voltsignal#overview) ---------------------------------------------------------- VoltSignal allows you to: * Create custom signals/events * Connect handlers to signals * Wait for signals to fire * Fire signals with arguments [Classes](https://docs.volt.bz/docs/voltsignal#classes) -------------------------------------------------------- ### [VoltSignal](https://docs.volt.bz/docs/voltsignal#voltsignal) | Method | Description | | --- | --- | | [`VoltSignal.new`](https://docs.volt.bz/docs/voltsignal/new) | Create a new VoltSignal | | [`VoltSignal:Connect`](https://docs.volt.bz/docs/voltsignal/connect) | Connect a handler function | | [`VoltSignal:Wait`](https://docs.volt.bz/docs/voltsignal/wait) | Yield until the signal fires | | [`VoltSignal:Fire`](https://docs.volt.bz/docs/voltsignal/fire) | Fire the signal with arguments | ### [VoltConnection](https://docs.volt.bz/docs/voltsignal#voltconnection) | Method | Description | | --- | --- | | [`VoltConnection:Disconnect`](https://docs.volt.bz/docs/voltsignal/disconnect) | Disconnect the connection | [replicatesignal\ \ Previous Page](https://docs.volt.bz/docs/signals/replicatesignal) [VoltSignal:Connect\ \ Next Page](https://docs.volt.bz/docs/voltsignal/connect) ### On this page [Overview](https://docs.volt.bz/docs/voltsignal#overview) [Classes](https://docs.volt.bz/docs/voltsignal#classes) [VoltSignal](https://docs.volt.bz/docs/voltsignal#voltsignal) [VoltConnection](https://docs.volt.bz/docs/voltsignal#voltconnection) --- # Volt Documentation Actors ====== The **Actors** library provides functions for working with Roblox's parallel Luau actors and Lua state management. [Overview](https://docs.volt.bz/docs/actors#overview) ------------------------------------------------------ These functions allow you to: * Get and manage actors in the game * Run code on specific actor threads * Create communication channels between actors * Check parallel execution state * Access and control Lua execution states * Monitor actor state creation [Available Functions](https://docs.volt.bz/docs/actors#available-functions) ---------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`create_comm_channel`](https://docs.volt.bz/docs/actors/create_comm_channel) | Create a communication channel | | [`get_comm_channel`](https://docs.volt.bz/docs/actors/get_comm_channel) | Get an existing communication channel | | [`getactors`](https://docs.volt.bz/docs/actors/getactors) | Get all actors in the game | | [`getactorstates`](https://docs.volt.bz/docs/actors/getactorstates) | Get all active LuaStateProxy objects | | [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) | Get LuaStateProxy for actor or script | | [`getgamestate`](https://docs.volt.bz/docs/actors/getgamestate) | Get the default game Lua state | | [`isparallel`](https://docs.volt.bz/docs/actors/isparallel) | Check if running in parallel | | [`on_actor_added`](https://docs.volt.bz/docs/actors/on_actor_added) | Event fired when actor is ready | | [`on_actor_state_created`](https://docs.volt.bz/docs/actors/on_actor_state_created) | Event fired when actor state is created | | [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) | Execute code on an actor | [What are Actors?](https://docs.volt.bz/docs/actors#what-are-actors) --------------------------------------------------------------------- Actors are Roblox's way of enabling parallel Luau execution. They allow scripts to run concurrently on multiple threads, improving performance for computationally intensive tasks. [Communication Channels](https://docs.volt.bz/docs/actors#communication-channels) ---------------------------------------------------------------------------------- Communication channels allow actors to send messages to each other. Use `create_comm_channel` to create a channel and `get_comm_channel` to retrieve it from another actor. [Introduction\ \ Previous Page](https://docs.volt.bz/docs) [create\_comm\_channel\ \ Next Page](https://docs.volt.bz/docs/actors/create_comm_channel) ### On this page [Overview](https://docs.volt.bz/docs/actors#overview) [Available Functions](https://docs.volt.bz/docs/actors#available-functions) [What are Actors?](https://docs.volt.bz/docs/actors#what-are-actors) [Communication Channels](https://docs.volt.bz/docs/actors#communication-channels) --- # Volt Documentation LuaStateProxy ============= The **LuaStateProxy** library provides a proxy object for accessing and controlling Lua execution states. [Overview](https://docs.volt.bz/docs/luastateproxy#overview) ------------------------------------------------------------- LuaStateProxy allows you to: * Access state properties and identifiers * Execute code on specific states * Communicate between different Lua states * Manage actors associated with states [Constructor](https://docs.volt.bz/docs/luastateproxy#constructor) ------------------------------------------------------------------- | Function | Description | | --- | --- | | [`LuaStateProxy.new`](https://docs.volt.bz/docs/luastateproxy/new) | Create a new LuaStateProxy for the current state | [Properties](https://docs.volt.bz/docs/luastateproxy#properties) ----------------------------------------------------------------- | Property | Type | Description | | --- | --- | --- | | [`Id`](https://docs.volt.bz/docs/luastateproxy/id) | `number` | Unique identifier for this Lua state | | [`IsActorState`](https://docs.volt.bz/docs/luastateproxy/isactorstate) | `boolean` | Whether this state was created for Actors | | [`Event`](https://docs.volt.bz/docs/luastateproxy/event) | `VoltSignal` | Generic event for communication between states | [Methods](https://docs.volt.bz/docs/luastateproxy#methods) ----------------------------------------------------------- | Method | Description | | --- | --- | | [`LuaStateProxy:GetActors`](https://docs.volt.bz/docs/luastateproxy/getactors) | Get all Actor instances for this state | | [`LuaStateProxy:Execute`](https://docs.volt.bz/docs/luastateproxy/execute) | Execute code on this Lua state | [getrendersteppedlist\ \ Previous Page](https://docs.volt.bz/docs/instances/getrendersteppedlist) [LuaStateProxy.Event\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/event) ### On this page [Overview](https://docs.volt.bz/docs/luastateproxy#overview) [Constructor](https://docs.volt.bz/docs/luastateproxy#constructor) [Properties](https://docs.volt.bz/docs/luastateproxy#properties) [Methods](https://docs.volt.bz/docs/luastateproxy#methods) --- # Volt Documentation Signals ======= The **Signals** library provides functions for firing and managing Roblox signals (events). [Overview](https://docs.volt.bz/docs/signals#overview) ------------------------------------------------------- These functions allow you to: * Fire signals programmatically * Get and manage signal connections * Replicate signals to the server [Available Functions](https://docs.volt.bz/docs/signals#available-functions) ----------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`cansignalreplicate`](https://docs.volt.bz/docs/signals/cansignalreplicate) | Check if a signal can replicate | | [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) | Fire a signal with arguments | | [`getconnections`](https://docs.volt.bz/docs/signals/getconnections) | Get all connections to a signal | | [`getsignalarguments`](https://docs.volt.bz/docs/signals/getsignalarguments) | Get argument types for a signal | | [`getsignalargumentsinfo`](https://docs.volt.bz/docs/signals/getsignalargumentsinfo) | Get detailed argument info | | [`getsignalwhitelist`](https://docs.volt.bz/docs/signals/getsignalwhitelist) | Get network whitelist signals | | [`replicatesignal`](https://docs.volt.bz/docs/signals/replicatesignal) | Fire a signal with replication | [loadstring\ \ Previous Page](https://docs.volt.bz/docs/scripts/loadstring) [cansignalreplicate\ \ Next Page](https://docs.volt.bz/docs/signals/cansignalreplicate) ### On this page [Overview](https://docs.volt.bz/docs/signals#overview) [Available Functions](https://docs.volt.bz/docs/signals#available-functions) --- # Volt Documentation Crypt ===== The **Crypt** library provides cryptographic functions for encryption, hashing, and random number generation. [Overview](https://docs.volt.bz/docs/crypt#overview) ----------------------------------------------------- These functions allow you to: * Encrypt and decrypt data * Generate cryptographic hashes * Create secure random values * Perform HMAC authentication [Available Functions](https://docs.volt.bz/docs/crypt#available-functions) --------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`crypt.encrypt`](https://docs.volt.bz/docs/crypt/encrypt) | Encrypt data with a key | | [`crypt.decrypt`](https://docs.volt.bz/docs/crypt/decrypt) | Decrypt data with a key | | [`crypt.hash`](https://docs.volt.bz/docs/crypt/hash) | Generate a hash of data | | [`crypt.hmac`](https://docs.volt.bz/docs/crypt/hmac) | Generate HMAC authentication code | | [`crypt.random`](https://docs.volt.bz/docs/crypt/random) | Generate random bytes | | [`crypt.generatekey`](https://docs.volt.bz/docs/crypt/generatekey) | Generate a random encryption key | | [`crypt.generatebytes`](https://docs.volt.bz/docs/crypt/generatebytes) | Generate random bytes | [Note](https://docs.volt.bz/docs/crypt#note) --------------------------------------------- Base64 encoding functions (`crypt.base64encode`, `crypt.base64decode`) and LZ4 compression functions (`crypt.lz4compress`, `crypt.lz4decompress`) are documented in the [Encoding](https://docs.volt.bz/docs/encoding) section. [rconsolewarn\ \ Previous Page](https://docs.volt.bz/docs/console/rconsolewarn) [crypt.decrypt\ \ Next Page](https://docs.volt.bz/docs/crypt/decrypt) ### On this page [Overview](https://docs.volt.bz/docs/crypt#overview) [Available Functions](https://docs.volt.bz/docs/crypt#available-functions) [Note](https://docs.volt.bz/docs/crypt#note) --- # Volt Documentation Metatable ========= The **Metatable** library provides functions for working with metatables and metamethods on Roblox objects. [Overview](https://docs.volt.bz/docs/metatable#overview) --------------------------------------------------------- These functions allow you to: * Access raw metatables on locked objects * Modify metatable read-only status * Get the namecall method in hooks [Available Functions](https://docs.volt.bz/docs/metatable#available-functions) ------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`getnamecallmethod`](https://docs.volt.bz/docs/metatable/getnamecallmethod) | Get the method name in a namecall hook | | [`getrawmetatable`](https://docs.volt.bz/docs/metatable/getrawmetatable) | Get the raw metatable of an object | | [`isreadonly`](https://docs.volt.bz/docs/metatable/isreadonly) | Check if a table is read-only | | [`iswritable`](https://docs.volt.bz/docs/metatable/iswritable) | Check if a table is writable | | [`makereadonly`](https://docs.volt.bz/docs/metatable/makereadonly) | Make a table read-only | | [`makewritable`](https://docs.volt.bz/docs/metatable/makewritable) | Make a table writable | | [`setnamecallmethod`](https://docs.volt.bz/docs/metatable/setnamecallmethod) | Set the method name in a namecall hook | | [`setrawmetatable`](https://docs.volt.bz/docs/metatable/setrawmetatable) | Set the raw metatable of an object | | [`setreadonly`](https://docs.volt.bz/docs/metatable/setreadonly) | Set a table's read-only status | [Understanding Metatables](https://docs.volt.bz/docs/metatable#understanding-metatables) ----------------------------------------------------------------------------------------- Metatables in Lua control the behavior of tables and userdata. They define how objects respond to operations like indexing, calling, and arithmetic. ### [Common Metamethods](https://docs.volt.bz/docs/metatable#common-metamethods) | Metamethod | Triggered By | | --- | --- | | `__index` | Reading a missing key (`obj.key`) | | `__newindex` | Writing to a key (`obj.key = value`) | | `__namecall` | Method calls (`obj:method()`) | | `__call` | Calling as function (`obj()`) | | `__tostring` | String conversion (`tostring(obj)`) | [LuaStateProxy.new\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/new) [getnamecallmethod\ \ Next Page](https://docs.volt.bz/docs/metatable/getnamecallmethod) ### On this page [Overview](https://docs.volt.bz/docs/metatable#overview) [Available Functions](https://docs.volt.bz/docs/metatable#available-functions) [Understanding Metatables](https://docs.volt.bz/docs/metatable#understanding-metatables) [Common Metamethods](https://docs.volt.bz/docs/metatable#common-metamethods) --- # Volt Documentation Instances ========= The **Instances** library provides functions for interacting with Roblox instances in special ways that aren't normally possible. [Overview](https://docs.volt.bz/docs/instances#overview) --------------------------------------------------------- These functions allow you to: * Clone instance references * Fire interaction events * Access hidden UI containers * Get all instances in the game [Available Functions](https://docs.volt.bz/docs/instances#available-functions) ------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`cloneref`](https://docs.volt.bz/docs/instances/cloneref) | Clone an instance reference | | [`compareinstances`](https://docs.volt.bz/docs/instances/compareinstances) | Compare two instance references | | [`fireclickdetector`](https://docs.volt.bz/docs/instances/fireclickdetector) | Trigger a ClickDetector | | [`fireproximityprompt`](https://docs.volt.bz/docs/instances/fireproximityprompt) | Trigger a ProximityPrompt | | [`firetouchinterest`](https://docs.volt.bz/docs/instances/firetouchinterest) | Trigger a Touched event | | [`getcallbackvalue`](https://docs.volt.bz/docs/instances/getcallbackvalue) | Get a callback property value | | [`gethui`](https://docs.volt.bz/docs/instances/gethui) | Get the hidden UI container | | [`getinstancecache`](https://docs.volt.bz/docs/instances/getinstancecache) | Get all cached instance references | | [`getinstances`](https://docs.volt.bz/docs/instances/getinstances) | Get all instances | | [`getnilinstances`](https://docs.volt.bz/docs/instances/getnilinstances) | Get all nil-parented instances | | [`getrendersteppedlist`](https://docs.volt.bz/docs/instances/getrendersteppedlist) | Get RenderStepped connections | [mousescroll\ \ Previous Page](https://docs.volt.bz/docs/input/mousescroll) [cloneref\ \ Next Page](https://docs.volt.bz/docs/instances/cloneref) ### On this page [Overview](https://docs.volt.bz/docs/instances#overview) [Available Functions](https://docs.volt.bz/docs/instances#available-functions) --- # Volt Documentation Reflection ========== The **Reflection** library provides functions for accessing hidden properties, managing thread identity, and modifying property scriptability. [Overview](https://docs.volt.bz/docs/reflection#overview) ---------------------------------------------------------- These functions allow you to: * Read and write hidden properties * Get and set thread identity level * Control whether properties are scriptable [Available Functions](https://docs.volt.bz/docs/reflection#available-functions) -------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) | Get a hidden property value | | [`gethiddenproperties`](https://docs.volt.bz/docs/reflection/gethiddenproperties) | Get all hidden properties | | [`getproperties`](https://docs.volt.bz/docs/reflection/getproperties) | Get all properties of an instance | | [`getthreadidentity`](https://docs.volt.bz/docs/reflection/getthreadidentity) | Get the current thread identity | | [`isnetworkowner`](https://docs.volt.bz/docs/reflection/isnetworkowner) | Check network ownership of a part | | [`isscriptable`](https://docs.volt.bz/docs/reflection/isscriptable) | Check if a property is scriptable | | [`sethiddenproperty`](https://docs.volt.bz/docs/reflection/sethiddenproperty) | Set a hidden property value | | [`setscriptable`](https://docs.volt.bz/docs/reflection/setscriptable) | Set a property's scriptability | | [`setsimulationradius`](https://docs.volt.bz/docs/reflection/setsimulationradius) | Set the simulation radius | | [`setthreadidentity`](https://docs.volt.bz/docs/reflection/setthreadidentity) | Set the current thread identity | [RakNet\ \ Previous Page](https://docs.volt.bz/docs/raknet) [gethiddenproperties\ \ Next Page](https://docs.volt.bz/docs/reflection/gethiddenproperties) ### On this page [Overview](https://docs.volt.bz/docs/reflection#overview) [Available Functions](https://docs.volt.bz/docs/reflection#available-functions) --- # Volt Documentation Scripts ======= The **Scripts** library provides functions for interacting with running scripts, loading modules, and compiling code. [Overview](https://docs.volt.bz/docs/scripts#overview) ------------------------------------------------------- These functions allow you to: * Get references to running scripts * Access script environments * Load and compile Lua code * Extract script information [Available Functions](https://docs.volt.bz/docs/scripts#available-functions) ----------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`getcallingscript`](https://docs.volt.bz/docs/scripts/getcallingscript) | Get the script that called the current function | | [`getloadedmodules`](https://docs.volt.bz/docs/scripts/getloadedmodules) | Get all loaded ModuleScripts | | [`getmodules`](https://docs.volt.bz/docs/scripts/getmodules) | Get all ModuleScripts in the game | | [`getrunningscripts`](https://docs.volt.bz/docs/scripts/getrunningscripts) | Get all running scripts | | [`getscriptbytecode`](https://docs.volt.bz/docs/scripts/getscriptbytecode) | Get a script's compiled bytecode | | [`getscriptclosure`](https://docs.volt.bz/docs/scripts/getscriptclosure) | Get a script's main function | | [`getscriptfromthread`](https://docs.volt.bz/docs/scripts/getscriptfromthread) | Get the script associated with a thread | | [`getscripthash`](https://docs.volt.bz/docs/scripts/getscripthash) | Get a hash of a script's bytecode | | [`getscripts`](https://docs.volt.bz/docs/scripts/getscripts) | Get all scripts in the game | | [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) | Get a script's environment | | [`loadstring`](https://docs.volt.bz/docs/scripts/loadstring) | Compile and load Lua code | [setthreadidentity\ \ Previous Page](https://docs.volt.bz/docs/reflection/setthreadidentity) [getcallingscript\ \ Next Page](https://docs.volt.bz/docs/scripts/getcallingscript) ### On this page [Overview](https://docs.volt.bz/docs/scripts#overview) [Available Functions](https://docs.volt.bz/docs/scripts#available-functions) --- # Volt Documentation Console ======= The **Console** library provides functions for creating and managing a custom console window. [Overview](https://docs.volt.bz/docs/console#overview) ------------------------------------------------------- These functions allow you to: * Create and manage a custom console window * Print messages with different log levels * Get user input from the console [Available Functions](https://docs.volt.bz/docs/console#available-functions) ----------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) | Create and show the console window | | [`rconsolehide`](https://docs.volt.bz/docs/console/rconsolehide) | Hide and destroy the console window | | [`rconsoletoggle`](https://docs.volt.bz/docs/console/rconsoletoggle) | Toggle console visibility | | [`rconsolehidden`](https://docs.volt.bz/docs/console/rconsolehidden) | Check if console is hidden | | [`rconsoletop`](https://docs.volt.bz/docs/console/rconsoletop) | Bring console to front | | [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) | Print text to console | | [`rconsoleinfo`](https://docs.volt.bz/docs/console/rconsoleinfo) | Print info message to console | | [`rconsolewarn`](https://docs.volt.bz/docs/console/rconsolewarn) | Print warning to console | | [`rconsoleerr`](https://docs.volt.bz/docs/console/rconsoleerr) | Print error to console | | [`rconsoleclear`](https://docs.volt.bz/docs/console/rconsoleclear) | Clear console output | | [`rconsolename`](https://docs.volt.bz/docs/console/rconsolename) | Set console window title | | [`rconsoleinput`](https://docs.volt.bz/docs/console/rconsoleinput) | Get input from user | [setstackhidden\ \ Previous Page](https://docs.volt.bz/docs/closures/setstackhidden) [rconsoleclear\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleclear) ### On this page [Overview](https://docs.volt.bz/docs/console#overview) [Available Functions](https://docs.volt.bz/docs/console#available-functions) --- # Volt Documentation Filesystem ========== The **Filesystem** library provides functions for reading, writing, and managing files on the local system. You cannot access files outside the workspace folder for security reasons, unless an explicit symlink is created within the workspace folder. [Overview](https://docs.volt.bz/docs/filesystem#overview) ---------------------------------------------------------- These functions allow you to: * Read and write files * Create and delete files and folders * Check if files and folders exist * List directory contents [Available Functions](https://docs.volt.bz/docs/filesystem#available-functions) -------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`appendfile`](https://docs.volt.bz/docs/filesystem/appendfile) | Append data to a file | | [`delfile`](https://docs.volt.bz/docs/filesystem/delfile) | Delete a file | | [`delfolder`](https://docs.volt.bz/docs/filesystem/delfolder) | Delete a folder | | [`dofile`](https://docs.volt.bz/docs/filesystem/dofile) | Load and execute a Lua file | | [`getcustomasset`](https://docs.volt.bz/docs/filesystem/getcustomasset) | Get a content URL for a local file | | [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) | Check if a path is a file | | [`isfolder`](https://docs.volt.bz/docs/filesystem/isfolder) | Check if a path is a folder | | [`listfiles`](https://docs.volt.bz/docs/filesystem/listfiles) | List files in a folder | | [`loadfile`](https://docs.volt.bz/docs/filesystem/loadfile) | Load a Lua file as a function | | [`makefolder`](https://docs.volt.bz/docs/filesystem/makefolder) | Create a folder | | [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) | Read contents of a file | | [`writefile`](https://docs.volt.bz/docs/filesystem/writefile) | Write data to a file | [Workspace Folder](https://docs.volt.bz/docs/filesystem#workspace-folder) -------------------------------------------------------------------------- All file operations are relative to volt's workspace folder. This is a sandboxed directory that prevents access to sensitive system files. -- These are relative to the workspace folder writefile("myfile.txt", "Hello") -- workspace/myfile.txt writefile("subfolder/file.txt", "Hi") -- workspace/subfolder/file.txt [gettenv\ \ Previous Page](https://docs.volt.bz/docs/environment/gettenv) [appendfile\ \ Next Page](https://docs.volt.bz/docs/filesystem/appendfile) ### On this page [Overview](https://docs.volt.bz/docs/filesystem#overview) [Available Functions](https://docs.volt.bz/docs/filesystem#available-functions) [Workspace Folder](https://docs.volt.bz/docs/filesystem#workspace-folder) --- # Volt Documentation Debug ===== The **Debug** library provides functions for runtime inspection of Luau functions, including access to constants, upvalues, protos, and stack values. [Overview](https://docs.volt.bz/docs/debug#overview) ----------------------------------------------------- These functions allow you to: * **Inspect** function internals (constants, upvalues, protos) * **Modify** function behavior at runtime * **Access** the call stack [Available Functions](https://docs.volt.bz/docs/debug#available-functions) --------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`debug.getcallstack`](https://docs.volt.bz/docs/debug/getcallstack) | Get the current call stack | | [`debug.getconstant`](https://docs.volt.bz/docs/debug/getconstant) | Get a constant from a function | | [`debug.getconstants`](https://docs.volt.bz/docs/debug/getconstants) | Get all constants from a function | | [`debug.getinfo`](https://docs.volt.bz/docs/debug/getinfo) | Get information about a function | | [`debug.getproto`](https://docs.volt.bz/docs/debug/getproto) | Get a proto (nested function) from a function | | [`debug.getprotos`](https://docs.volt.bz/docs/debug/getprotos) | Get all protos from a function | | [`debug.getstack`](https://docs.volt.bz/docs/debug/getstack) | Get a value from the stack | | [`debug.getupvalue`](https://docs.volt.bz/docs/debug/getupvalue) | Get an upvalue from a function | | [`debug.getupvalues`](https://docs.volt.bz/docs/debug/getupvalues) | Get all upvalues from a function | | [`debug.setconstant`](https://docs.volt.bz/docs/debug/setconstant) | Set a constant in a function | | [`debug.setstack`](https://docs.volt.bz/docs/debug/setstack) | Set a value on the stack | | [`debug.setupvalue`](https://docs.volt.bz/docs/debug/setupvalue) | Set an upvalue in a function | | [`debug.validlevel`](https://docs.volt.bz/docs/debug/validlevel) | Check if a stack level is valid | [Terminology](https://docs.volt.bz/docs/debug#terminology) ----------------------------------------------------------- ### [Constants](https://docs.volt.bz/docs/debug#constants) Values embedded directly in the function's bytecode. These include: * String literals * Numbers * Booleans * `nil` ### [Upvalues](https://docs.volt.bz/docs/debug#upvalues) Variables captured from the enclosing scope. When a function references a variable from outside its own scope, that variable becomes an upvalue. ### [Protos](https://docs.volt.bz/docs/debug#protos) Nested function definitions within a function. These are the "prototypes" of inner functions. ### [Stack](https://docs.volt.bz/docs/debug#stack) The call stack containing local variables and temporary values for the current execution context. [crypt.random\ \ Previous Page](https://docs.volt.bz/docs/crypt/random) [debug.getcallstack\ \ Next Page](https://docs.volt.bz/docs/debug/getcallstack) ### On this page [Overview](https://docs.volt.bz/docs/debug#overview) [Available Functions](https://docs.volt.bz/docs/debug#available-functions) [Terminology](https://docs.volt.bz/docs/debug#terminology) [Constants](https://docs.volt.bz/docs/debug#constants) [Upvalues](https://docs.volt.bz/docs/debug#upvalues) [Protos](https://docs.volt.bz/docs/debug#protos) [Stack](https://docs.volt.bz/docs/debug#stack) --- # Volt Documentation Closures ======== The **Closures** library allows for viewing info about a closures origin and allowing the manipulation of said closure. [Overview](https://docs.volt.bz/docs/closures#overview) -------------------------------------------------------- This library provides tools to: * **Inspect** closures to determine their type and origin * **Modify** closures by hooking or replacing them * **Create** new closures with specific properties [Available Functions](https://docs.volt.bz/docs/closures#available-functions) ------------------------------------------------------------------------------ | Function | Description | | --- | --- | | [`checkcaller`](https://docs.volt.bz/docs/closures/checkcaller) | Check if the current call is from volt | | [`clonefunction`](https://docs.volt.bz/docs/closures/clonefunction) | Create a copy of a function | | [`getfunctionhash`](https://docs.volt.bz/docs/closures/getfunctionhash) | Get the hash of a function's bytecode | | [`hookfunction`](https://docs.volt.bz/docs/closures/hookfunction) | Replace a function with another | | [`hookmetamethod`](https://docs.volt.bz/docs/closures/hookmetamethod) | Hook a metatable metamethod | | [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) | Check if a function is a C closure | | [`isexecutorclosure`](https://docs.volt.bz/docs/closures/isexecutorclosure) | Check if a function is from volt | | [`isfunctionhooked`](https://docs.volt.bz/docs/closures/isfunctionhooked) | Check if a function has been hooked | | [`islclosure`](https://docs.volt.bz/docs/closures/islclosure) | Check if a function is a Luau closure | | [`isnewcclosure`](https://docs.volt.bz/docs/closures/isnewcclosure) | Check if a function is a newcclosure | | [`newcclosure`](https://docs.volt.bz/docs/closures/newcclosure) | Wrap a Luau function as a C closure | | [`newlclosure`](https://docs.volt.bz/docs/closures/newlclosure) | Wrap a C closure as a Luau closure | | [`restorefunction`](https://docs.volt.bz/docs/closures/restorefunction) | Restore a hooked function to its original | | [`setstackhidden`](https://docs.volt.bz/docs/closures/setstackhidden) | Hide a function from stack traces | [Closure Types](https://docs.volt.bz/docs/closures#closure-types) ------------------------------------------------------------------ There are two main types of closures: ### [C Closures](https://docs.volt.bz/docs/closures#c-closures) Functions implemented in C/C++. These are typically: * Built-in Lua functions like `print`, `type` * Roblox API methods * Majority of custom functions ### [Luau Closures](https://docs.volt.bz/docs/closures#luau-closures) Functions written in Luau. These are typically: * User-defined functions * Game Script functions [cache.replace\ \ Previous Page](https://docs.volt.bz/docs/cache/replace) [checkcaller\ \ Next Page](https://docs.volt.bz/docs/closures/checkcaller) ### On this page [Overview](https://docs.volt.bz/docs/closures#overview) [Available Functions](https://docs.volt.bz/docs/closures#available-functions) [Closure Types](https://docs.volt.bz/docs/closures#closure-types) [C Closures](https://docs.volt.bz/docs/closures#c-closures) [Luau Closures](https://docs.volt.bz/docs/closures#luau-closures) --- # Volt Documentation Miscellaneous ============= The **Miscellaneous** library contains various utility functions that don't fit into other categories. [Available Functions](https://docs.volt.bz/docs/miscellaneous#available-functions) ----------------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`clearqueueonteleport`](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport) | Clear the teleport script queue | | [`getfflag`](https://docs.volt.bz/docs/miscellaneous/getfflag) | Get a Roblox Fast Flag value | | [`getfpscap`](https://docs.volt.bz/docs/miscellaneous/getfpscap) | Get current FPS cap | | [`gethwid`](https://docs.volt.bz/docs/miscellaneous/gethwid) | Get hardware identifier | | [`identifyexecutor`](https://docs.volt.bz/docs/miscellaneous/identifyexecutor) | Get volt's name and version | | [`messagebox`](https://docs.volt.bz/docs/miscellaneous/messagebox) | Display a message box | | [`queueonteleport`](https://docs.volt.bz/docs/miscellaneous/queueonteleport) | Queue script for after teleport | | [`request`](https://docs.volt.bz/docs/miscellaneous/request) | Make HTTP requests | | [`saveinstance`](https://docs.volt.bz/docs/miscellaneous/saveinstance) | Save instance to file | | [`saveplace`](https://docs.volt.bz/docs/miscellaneous/saveplace) | Save the current place | | [`setclipboard`](https://docs.volt.bz/docs/miscellaneous/setclipboard) | Copy text to clipboard | | [`setfflag`](https://docs.volt.bz/docs/miscellaneous/setfflag) | Set a Roblox Fast Flag value | | [`setfpscap`](https://docs.volt.bz/docs/miscellaneous/setfpscap) | Set FPS cap | [setreadonly\ \ Previous Page](https://docs.volt.bz/docs/metatable/setreadonly) [clearqueueonteleport\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport) ### On this page [Available Functions](https://docs.volt.bz/docs/miscellaneous#available-functions) --- # Volt Documentation Input ===== The **Input** library provides functions for simulating keyboard and mouse input. [Overview](https://docs.volt.bz/docs/input#overview) ----------------------------------------------------- These functions allow you to: * Simulate keyboard key presses * Simulate mouse button clicks * Move the mouse cursor [Available Functions](https://docs.volt.bz/docs/input#available-functions) --------------------------------------------------------------------------- | Function | Description | | --- | --- | | [`iswindowactive`](https://docs.volt.bz/docs/input/iswindowactive) | Check if game window is focused | | [`keypress`](https://docs.volt.bz/docs/input/keypress) | Simulate key press | | [`keyrelease`](https://docs.volt.bz/docs/input/keyrelease) | Simulate key release | | [`keyclick`](https://docs.volt.bz/docs/input/keyclick) | Simulate key click (press+release) | | [`mouse1press`](https://docs.volt.bz/docs/input/mouse1press) | Simulate left mouse press | | [`mouse1release`](https://docs.volt.bz/docs/input/mouse1release) | Simulate left mouse release | | [`mouse1click`](https://docs.volt.bz/docs/input/mouse1click) | Simulate left mouse click | | [`mouse2press`](https://docs.volt.bz/docs/input/mouse2press) | Simulate right mouse press | | [`mouse2release`](https://docs.volt.bz/docs/input/mouse2release) | Simulate right mouse release | | [`mouse2click`](https://docs.volt.bz/docs/input/mouse2click) | Simulate right mouse click | | [`mousescroll`](https://docs.volt.bz/docs/input/mousescroll) | Simulate mouse scroll | | [`mousemoverel`](https://docs.volt.bz/docs/input/mousemoverel) | Move mouse relative to position | | [`mousemoveabs`](https://docs.volt.bz/docs/input/mousemoveabs) | Move mouse to absolute position | [writefile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/writefile) [iswindowactive\ \ Next Page](https://docs.volt.bz/docs/input/iswindowactive) ### On this page [Overview](https://docs.volt.bz/docs/input#overview) [Available Functions](https://docs.volt.bz/docs/input#available-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) create\_comm\_channel ===================== Creates a communication channel for sending messages between actors. [Syntax](https://docs.volt.bz/docs/actors/create_comm_channel#syntax) ---------------------------------------------------------------------- create_comm_channel(name: string?) -> (string, Channel) [Parameters](https://docs.volt.bz/docs/actors/create_comm_channel#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `name` | `string` | (Optional) Name for the channel | [Returns](https://docs.volt.bz/docs/actors/create_comm_channel#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `string` | The channel identifier | | `Channel` | The channel object | [Description](https://docs.volt.bz/docs/actors/create_comm_channel#description) -------------------------------------------------------------------------------- `create_comm_channel` creates a new communication channel that can be used to send and receive messages between actors and the main thread. [Channel Object](https://docs.volt.bz/docs/actors/create_comm_channel#channel-object) -------------------------------------------------------------------------------------- | Property/Method | Description | | --- | --- | | `Event` | Signal to connect for receiving | | `Fire(...)` | Send a message through the channel | [Example](https://docs.volt.bz/docs/actors/create_comm_channel#example) ------------------------------------------------------------------------ local id, channel = create_comm_channel() -- Listen for messages channel.Event:Connect(function(message) print("Received:", message) end) -- Send to an actor run_on_actor(someActor, [[\ local channelId = ...\ local channel = get_comm_channel(channelId)\ channel:Fire("Hello from actor!")\ ]], id) [Bidirectional Communication](https://docs.volt.bz/docs/actors/create_comm_channel#bidirectional-communication) ---------------------------------------------------------------------------------------------------------------- -- Main thread local id, channel = create_comm_channel() channel.Event:Connect(function(response) print("Actor responded:", response) end) -- Actor sends back run_on_actor(actor, [[\ local id = ...\ local channel = get_comm_channel(id)\ channel:Fire("Message received!")\ ]], id) [Related Functions](https://docs.volt.bz/docs/actors/create_comm_channel#related-functions) -------------------------------------------------------------------------------------------- * [`get_comm_channel`](https://docs.volt.bz/docs/actors/get_comm_channel) - Retrieve a channel * [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) - Run code on an actor [Actors\ \ Previous Page](https://docs.volt.bz/docs/actors) [get\_comm\_channel\ \ Next Page](https://docs.volt.bz/docs/actors/get_comm_channel) ### On this page [Syntax](https://docs.volt.bz/docs/actors/create_comm_channel#syntax) [Parameters](https://docs.volt.bz/docs/actors/create_comm_channel#parameters) [Returns](https://docs.volt.bz/docs/actors/create_comm_channel#returns) [Description](https://docs.volt.bz/docs/actors/create_comm_channel#description) [Channel Object](https://docs.volt.bz/docs/actors/create_comm_channel#channel-object) [Example](https://docs.volt.bz/docs/actors/create_comm_channel#example) [Bidirectional Communication](https://docs.volt.bz/docs/actors/create_comm_channel#bidirectional-communication) [Related Functions](https://docs.volt.bz/docs/actors/create_comm_channel#related-functions) --- # Volt Documentation [Cache](https://docs.volt.bz/docs/cache) cache.invalidate ================ Removes an instance from the reference cache. [Syntax](https://docs.volt.bz/docs/cache/invalidate#syntax) ------------------------------------------------------------ cache.invalidate(instance: Instance) -> void [Parameters](https://docs.volt.bz/docs/cache/invalidate#parameters) -------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to invalidate | [Returns](https://docs.volt.bz/docs/cache/invalidate#returns) -------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/cache/invalidate#description) ---------------------------------------------------------------------- `cache.invalidate` removes an instance from the internal reference cache. The next access to this instance will create a new reference. [Example](https://docs.volt.bz/docs/cache/invalidate#example) -------------------------------------------------------------- local part = workspace.Part -- Store a reference local ref1 = part -- Invalidate the cache cache.invalidate(part) -- New reference is created local ref2 = workspace.Part print(ref1 == ref2) -- May be false [Notes](https://docs.volt.bz/docs/cache/invalidate#notes) ---------------------------------------------------------- * Used for advanced instance manipulation * Affects how references are tracked [Related Functions](https://docs.volt.bz/docs/cache/invalidate#related-functions) ---------------------------------------------------------------------------------- * [`cache.replace`](https://docs.volt.bz/docs/cache/replace) - Replace cached instance * [`cache.iscached`](https://docs.volt.bz/docs/cache/iscached) - Check if cached [Cache\ \ Previous Page](https://docs.volt.bz/docs/cache) [cache.iscached\ \ Next Page](https://docs.volt.bz/docs/cache/iscached) ### On this page [Syntax](https://docs.volt.bz/docs/cache/invalidate#syntax) [Parameters](https://docs.volt.bz/docs/cache/invalidate#parameters) [Returns](https://docs.volt.bz/docs/cache/invalidate#returns) [Description](https://docs.volt.bz/docs/cache/invalidate#description) [Example](https://docs.volt.bz/docs/cache/invalidate#example) [Notes](https://docs.volt.bz/docs/cache/invalidate#notes) [Related Functions](https://docs.volt.bz/docs/cache/invalidate#related-functions) --- # Volt Documentation [Cache](https://docs.volt.bz/docs/cache) cache.iscached ============== Checks if an instance is in the reference cache. [Syntax](https://docs.volt.bz/docs/cache/iscached#syntax) ---------------------------------------------------------- cache.iscached(instance: Instance) -> boolean [Parameters](https://docs.volt.bz/docs/cache/iscached#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to check | [Returns](https://docs.volt.bz/docs/cache/iscached#returns) ------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | True if the instance is cached | [Description](https://docs.volt.bz/docs/cache/iscached#description) -------------------------------------------------------------------- `cache.iscached` checks whether an instance currently exists in the reference cache. [Example](https://docs.volt.bz/docs/cache/iscached#example) ------------------------------------------------------------ local part = workspace.Part if cache.iscached(part) then print("Part is cached") else print("Part is not cached") end -- After invalidation cache.invalidate(part) print(cache.iscached(part)) -- false [Related Functions](https://docs.volt.bz/docs/cache/iscached#related-functions) -------------------------------------------------------------------------------- * [`cache.replace`](https://docs.volt.bz/docs/cache/replace) - Replace cached instance * [`cache.invalidate`](https://docs.volt.bz/docs/cache/invalidate) - Remove from cache [cache.invalidate\ \ Previous Page](https://docs.volt.bz/docs/cache/invalidate) [cache.replace\ \ Next Page](https://docs.volt.bz/docs/cache/replace) ### On this page [Syntax](https://docs.volt.bz/docs/cache/iscached#syntax) [Parameters](https://docs.volt.bz/docs/cache/iscached#parameters) [Returns](https://docs.volt.bz/docs/cache/iscached#returns) [Description](https://docs.volt.bz/docs/cache/iscached#description) [Example](https://docs.volt.bz/docs/cache/iscached#example) [Related Functions](https://docs.volt.bz/docs/cache/iscached#related-functions) --- # Volt Documentation [Cache](https://docs.volt.bz/docs/cache) cache.replace ============= Replaces a cached instance reference with another. [Syntax](https://docs.volt.bz/docs/cache/replace#syntax) --------------------------------------------------------- cache.replace(instance: Instance, replacement: Instance) -> void [Parameters](https://docs.volt.bz/docs/cache/replace#parameters) ----------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to replace | | `replacement` | `Instance` | The replacement instance | [Returns](https://docs.volt.bz/docs/cache/replace#returns) ----------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/cache/replace#description) ------------------------------------------------------------------- `cache.replace` replaces a cached instance reference with another instance. All existing references to the original instance will now point to the replacement. [Example](https://docs.volt.bz/docs/cache/replace#example) ----------------------------------------------------------- local original = workspace.Part local replacement = Instance.new("Part") replacement.Name = "FakePart" -- Replace the cached reference cache.replace(original, replacement) -- Now any access to the original returns the replacement print(workspace.Part.Name) -- "FakePart" [Notes](https://docs.volt.bz/docs/cache/replace#notes) ------------------------------------------------------- * Use with caution as this affects all references * The original instance still exists [Related Functions](https://docs.volt.bz/docs/cache/replace#related-functions) ------------------------------------------------------------------------------- * [`cache.invalidate`](https://docs.volt.bz/docs/cache/invalidate) - Remove from cache * [`cache.iscached`](https://docs.volt.bz/docs/cache/iscached) - Check if cached [cache.iscached\ \ Previous Page](https://docs.volt.bz/docs/cache/iscached) [Closures\ \ Next Page](https://docs.volt.bz/docs/closures) ### On this page [Syntax](https://docs.volt.bz/docs/cache/replace#syntax) [Parameters](https://docs.volt.bz/docs/cache/replace#parameters) [Returns](https://docs.volt.bz/docs/cache/replace#returns) [Description](https://docs.volt.bz/docs/cache/replace#description) [Example](https://docs.volt.bz/docs/cache/replace#example) [Notes](https://docs.volt.bz/docs/cache/replace#notes) [Related Functions](https://docs.volt.bz/docs/cache/replace#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) checkcaller =========== Returns whether the current function was called by volt. [Syntax](https://docs.volt.bz/docs/closures/checkcaller#syntax) ---------------------------------------------------------------- checkcaller() -> boolean [Returns](https://docs.volt.bz/docs/closures/checkcaller#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | `true` if called from volt thread, `false` otherwise | [Description](https://docs.volt.bz/docs/closures/checkcaller#description) -------------------------------------------------------------------------- `checkcaller` returns a boolean indicating whether the current function was invoked from volt's own thread. This is useful for differentiating between your own calls and those made by the game. When you hook a game function, both your code and the game will trigger it. Use `checkcaller` to determine whether to run custom logic or pass through to the original. [Example](https://docs.volt.bz/docs/closures/checkcaller#example) ------------------------------------------------------------------ local old old = hookfunction(game.HttpGet, function(self, url, ...) if checkcaller() then -- Call is from our script, allow it return old(self, url, ...) end -- Call is from the game, we can block or modify it print("Game tried to fetch:", url) return old(self, url, ...) end) -- This will pass checkcaller() because we're calling it local result = game:HttpGet("https://example.com") [Closures\ \ Previous Page](https://docs.volt.bz/docs/closures) [clonefunction\ \ Next Page](https://docs.volt.bz/docs/closures/clonefunction) ### On this page [Syntax](https://docs.volt.bz/docs/closures/checkcaller#syntax) [Returns](https://docs.volt.bz/docs/closures/checkcaller#returns) [Description](https://docs.volt.bz/docs/closures/checkcaller#description) [Example](https://docs.volt.bz/docs/closures/checkcaller#example) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) get\_comm\_channel ================== Retrieves an existing communication channel by its identifier. [Syntax](https://docs.volt.bz/docs/actors/get_comm_channel#syntax) ------------------------------------------------------------------- get_comm_channel(id: string) -> Channel [Parameters](https://docs.volt.bz/docs/actors/get_comm_channel#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `id` | `string` | The channel identifier | [Returns](https://docs.volt.bz/docs/actors/get_comm_channel#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `Channel` | The channel object | [Description](https://docs.volt.bz/docs/actors/get_comm_channel#description) ----------------------------------------------------------------------------- `get_comm_channel` retrieves a communication channel that was created with `create_comm_channel`. This is typically used inside an actor to get a reference to a channel created on the main thread. [Example](https://docs.volt.bz/docs/actors/get_comm_channel#example) --------------------------------------------------------------------- -- On main thread local id, channel = create_comm_channel() channel.Event:Connect(print) -- Inside actor (via run_on_actor) run_on_actor(actor, [[\ local channelId = ...\ local channel = get_comm_channel(channelId)\ channel:Fire("Hello from actor!")\ ]], id) [Notes](https://docs.volt.bz/docs/actors/get_comm_channel#notes) ----------------------------------------------------------------- * The channel ID is passed from the main thread to the actor * Use this inside actors to communicate back to the main thread [Related Functions](https://docs.volt.bz/docs/actors/get_comm_channel#related-functions) ----------------------------------------------------------------------------------------- * [`create_comm_channel`](https://docs.volt.bz/docs/actors/create_comm_channel) - Create a channel * [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) - Run code on an actor [create\_comm\_channel\ \ Previous Page](https://docs.volt.bz/docs/actors/create_comm_channel) [getactors\ \ Next Page](https://docs.volt.bz/docs/actors/getactors) ### On this page [Syntax](https://docs.volt.bz/docs/actors/get_comm_channel#syntax) [Parameters](https://docs.volt.bz/docs/actors/get_comm_channel#parameters) [Returns](https://docs.volt.bz/docs/actors/get_comm_channel#returns) [Description](https://docs.volt.bz/docs/actors/get_comm_channel#description) [Example](https://docs.volt.bz/docs/actors/get_comm_channel#example) [Notes](https://docs.volt.bz/docs/actors/get_comm_channel#notes) [Related Functions](https://docs.volt.bz/docs/actors/get_comm_channel#related-functions) --- # Volt Documentation [Drawing](https://docs.volt.bz/docs/drawing) cleardrawcache ============== Removes all cached drawing objects. [Syntax](https://docs.volt.bz/docs/drawing/cleardrawcache#syntax) ------------------------------------------------------------------ cleardrawcache() -> void [Returns](https://docs.volt.bz/docs/drawing/cleardrawcache#returns) -------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/drawing/cleardrawcache#description) ---------------------------------------------------------------------------- `cleardrawcache` removes all drawing objects that have been created. This is useful for cleanup when you want to clear all visual overlays at once. [Example](https://docs.volt.bz/docs/drawing/cleardrawcache#example) -------------------------------------------------------------------- -- Create several drawings local drawings = {} for i = 1, 10 do local circle = Drawing.new("Circle") circle.Position = Vector2.new(100 * i, 100) circle.Radius = 50 circle.Visible = true table.insert(drawings, circle) end -- Later, clear everything at once cleardrawcache() -- All 10 circles are now removed [Use Cases](https://docs.volt.bz/docs/drawing/cleardrawcache#use-cases) ------------------------------------------------------------------------ * **Script cleanup**: Remove all drawings when a script ends * **Reset**: Clear all visuals before recreating them * **Performance**: Free memory from unused drawings [Notes](https://docs.volt.bz/docs/drawing/cleardrawcache#notes) ---------------------------------------------------------------- * This removes ALL drawings, not just ones you created * Use with caution in multi-script environments * Individual drawings can be removed with `:Remove()` [Drawing\ \ Previous Page](https://docs.volt.bz/docs/drawing) [getrenderproperty\ \ Next Page](https://docs.volt.bz/docs/drawing/getrenderproperty) ### On this page [Syntax](https://docs.volt.bz/docs/drawing/cleardrawcache#syntax) [Returns](https://docs.volt.bz/docs/drawing/cleardrawcache#returns) [Description](https://docs.volt.bz/docs/drawing/cleardrawcache#description) [Example](https://docs.volt.bz/docs/drawing/cleardrawcache#example) [Use Cases](https://docs.volt.bz/docs/drawing/cleardrawcache#use-cases) [Notes](https://docs.volt.bz/docs/drawing/cleardrawcache#notes) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.decrypt ============= Decrypts data using a specified algorithm and key. [Syntax](https://docs.volt.bz/docs/crypt/decrypt#syntax) --------------------------------------------------------- crypt.decrypt(data: string, key: string, iv: string?, algorithm: string?) -> string [Parameters](https://docs.volt.bz/docs/crypt/decrypt#parameters) ----------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The encrypted data | | `key` | `string` | The decryption key | | `iv` | `string` | (Optional) Initialization vector | | `algorithm` | `string` | (Optional) Algorithm, defaults to "AES-CBC" | [Returns](https://docs.volt.bz/docs/crypt/decrypt#returns) ----------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The decrypted data | [Description](https://docs.volt.bz/docs/crypt/decrypt#description) ------------------------------------------------------------------- `crypt.decrypt` decrypts data that was encrypted with `crypt.encrypt` using the same algorithm and key. [Example](https://docs.volt.bz/docs/crypt/decrypt#example) ----------------------------------------------------------- local key = crypt.generatekey() local original = "Hello, World!" -- Encrypt and decrypt local encrypted = crypt.encrypt(original, key) local decrypted = crypt.decrypt(encrypted, key) print(decrypted) -- "Hello, World!" [Related Functions](https://docs.volt.bz/docs/crypt/decrypt#related-functions) ------------------------------------------------------------------------------- * [`crypt.encrypt`](https://docs.volt.bz/docs/crypt/encrypt) - Encrypt data * [`crypt.generatekey`](https://docs.volt.bz/docs/crypt/generatekey) - Generate a key [Crypt\ \ Previous Page](https://docs.volt.bz/docs/crypt) [crypt.encrypt\ \ Next Page](https://docs.volt.bz/docs/crypt/encrypt) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/decrypt#syntax) [Parameters](https://docs.volt.bz/docs/crypt/decrypt#parameters) [Returns](https://docs.volt.bz/docs/crypt/decrypt#returns) [Description](https://docs.volt.bz/docs/crypt/decrypt#description) [Example](https://docs.volt.bz/docs/crypt/decrypt#example) [Related Functions](https://docs.volt.bz/docs/crypt/decrypt#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) getactors ========= Gets all actors in the game. [Syntax](https://docs.volt.bz/docs/actors/getactors#syntax) ------------------------------------------------------------ getactors() -> {Actor} [Aliases](https://docs.volt.bz/docs/actors/getactors#aliases) -------------------------------------------------------------- * `get_actors` [Returns](https://docs.volt.bz/docs/actors/getactors#returns) -------------------------------------------------------------- | Type | Description | | --- | --- | | `{Actor}` | Array of all actors in the game | [Description](https://docs.volt.bz/docs/actors/getactors#description) ---------------------------------------------------------------------- `getactors` returns all Actor instances currently in the game. This is useful for discovering available actors to run code on. [Example](https://docs.volt.bz/docs/actors/getactors#example) -------------------------------------------------------------- local actors = getactors() print("Total actors:", #actors) for i, actor in ipairs(actors) do print(i, actor:GetFullName()) end [Related Functions](https://docs.volt.bz/docs/actors/getactors#related-functions) ---------------------------------------------------------------------------------- * [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) - Run code on an actor * [`isparallel`](https://docs.volt.bz/docs/actors/isparallel) - Check if running in parallel [get\_comm\_channel\ \ Previous Page](https://docs.volt.bz/docs/actors/get_comm_channel) [getactorstates\ \ Next Page](https://docs.volt.bz/docs/actors/getactorstates) ### On this page [Syntax](https://docs.volt.bz/docs/actors/getactors#syntax) [Aliases](https://docs.volt.bz/docs/actors/getactors#aliases) [Returns](https://docs.volt.bz/docs/actors/getactors#returns) [Description](https://docs.volt.bz/docs/actors/getactors#description) [Example](https://docs.volt.bz/docs/actors/getactors#example) [Related Functions](https://docs.volt.bz/docs/actors/getactors#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) getactorstates ============== Returns all active LuaStateProxy objects. [Syntax](https://docs.volt.bz/docs/actors/getactorstates#syntax) ----------------------------------------------------------------- getactorstates() -> {LuaStateProxy} [Returns](https://docs.volt.bz/docs/actors/getactorstates#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `{LuaStateProxy}` | Array of all active LuaStateProxy objects | [Description](https://docs.volt.bz/docs/actors/getactorstates#description) --------------------------------------------------------------------------- `getactorstates` returns all active `LuaStateProxy` objects in the game. This includes both actor states and the main game state. Each `LuaStateProxy` represents a unique Lua execution environment. [Example](https://docs.volt.bz/docs/actors/getactorstates#example) ------------------------------------------------------------------- local states = getactorstates() print("Total Lua states:", #states) for i, state in ipairs(states) do print(i, "State ID:", state.Id, "Is Actor:", state.IsActorState) end [Filter Actor States](https://docs.volt.bz/docs/actors/getactorstates#filter-actor-states) ------------------------------------------------------------------------------------------- local states = getactorstates() local actorStates = {} for _, state in ipairs(states) do if state.IsActorState then table.insert(actorStates, state) end end print("Actor states:", #actorStates) [Related Functions](https://docs.volt.bz/docs/actors/getactorstates#related-functions) --------------------------------------------------------------------------------------- * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get LuaStateProxy for a specific actor or script * [`getgamestate`](https://docs.volt.bz/docs/actors/getgamestate) - Get the default game Lua state * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all Actor instances [getactors\ \ Previous Page](https://docs.volt.bz/docs/actors/getactors) [getgamestate\ \ Next Page](https://docs.volt.bz/docs/actors/getgamestate) ### On this page [Syntax](https://docs.volt.bz/docs/actors/getactorstates#syntax) [Returns](https://docs.volt.bz/docs/actors/getactorstates#returns) [Description](https://docs.volt.bz/docs/actors/getactorstates#description) [Example](https://docs.volt.bz/docs/actors/getactorstates#example) [Filter Actor States](https://docs.volt.bz/docs/actors/getactorstates#filter-actor-states) [Related Functions](https://docs.volt.bz/docs/actors/getactorstates#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) clonefunction ============= Creates a copy of the given function. [Syntax](https://docs.volt.bz/docs/closures/clonefunction#syntax) ------------------------------------------------------------------ clonefunction(func: function) -> function [Parameters](https://docs.volt.bz/docs/closures/clonefunction#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to clone | [Returns](https://docs.volt.bz/docs/closures/clonefunction#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `function` | A copy of the original function | [Description](https://docs.volt.bz/docs/closures/clonefunction#description) ---------------------------------------------------------------------------- `clonefunction` creates an independent copy of a function. The cloned function behaves identically to the original but is a separate entity. This is particularly useful when you need to keep a reference to the original behavior before hooking. [Example](https://docs.volt.bz/docs/closures/clonefunction#example) -------------------------------------------------------------------- -- Clone a function before hooking it local originalPrint = clonefunction(print) -- Now hook the original hookfunction(print, function(...) originalPrint("[HOOKED]", ...) end) -- The clone still works as the original originalPrint("This bypasses the hook") -- The hooked version adds prefix print("This goes through the hook") -- Output: [HOOKED] This goes through the hook [Notes](https://docs.volt.bz/docs/closures/clonefunction#notes) ---------------------------------------------------------------- * The cloned function shares the same upvalues as the original * For C closures, the clone wraps the same underlying C function * Cloning is useful for preserving original behavior during hooks [Aliases](https://docs.volt.bz/docs/closures/clonefunction#aliases) -------------------------------------------------------------------- * `clonefunc` [checkcaller\ \ Previous Page](https://docs.volt.bz/docs/closures/checkcaller) [getfunctionhash\ \ Next Page](https://docs.volt.bz/docs/closures/getfunctionhash) ### On this page [Syntax](https://docs.volt.bz/docs/closures/clonefunction#syntax) [Parameters](https://docs.volt.bz/docs/closures/clonefunction#parameters) [Returns](https://docs.volt.bz/docs/closures/clonefunction#returns) [Description](https://docs.volt.bz/docs/closures/clonefunction#description) [Example](https://docs.volt.bz/docs/closures/clonefunction#example) [Notes](https://docs.volt.bz/docs/closures/clonefunction#notes) [Aliases](https://docs.volt.bz/docs/closures/clonefunction#aliases) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleclear ============= Clears all text from the console window. [Syntax](https://docs.volt.bz/docs/console/rconsoleclear#syntax) ----------------------------------------------------------------- rconsoleclear() -> void [Aliases](https://docs.volt.bz/docs/console/rconsoleclear#aliases) ------------------------------------------------------------------- * `consoleclear` [Returns](https://docs.volt.bz/docs/console/rconsoleclear#returns) ------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoleclear#description) --------------------------------------------------------------------------- `rconsoleclear` removes all text from the console window, giving you a clean slate. [Example](https://docs.volt.bz/docs/console/rconsoleclear#example) ------------------------------------------------------------------- rconsoleshow() rconsoleprint("This will be cleared\n") rconsoleprint("So will this\n") task.wait(2) rconsoleclear() rconsoleprint("Fresh start!\n") [Related Functions](https://docs.volt.bz/docs/console/rconsoleclear#related-functions) --------------------------------------------------------------------------------------- * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print to console [Console\ \ Previous Page](https://docs.volt.bz/docs/console) [rconsoleerr\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleerr) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleclear#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsoleclear#aliases) [Returns](https://docs.volt.bz/docs/console/rconsoleclear#returns) [Description](https://docs.volt.bz/docs/console/rconsoleclear#description) [Example](https://docs.volt.bz/docs/console/rconsoleclear#example) [Related Functions](https://docs.volt.bz/docs/console/rconsoleclear#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getcallstack ================== Gets the current call stack. [Syntax](https://docs.volt.bz/docs/debug/getcallstack#syntax) -------------------------------------------------------------- debug.getcallstack(level: number?) -> table [Parameters](https://docs.volt.bz/docs/debug/getcallstack#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `level` | `number` | (Optional) Starting level, default 1 | [Returns](https://docs.volt.bz/docs/debug/getcallstack#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of call stack entries | [Description](https://docs.volt.bz/docs/debug/getcallstack#description) ------------------------------------------------------------------------ `debug.getcallstack` returns information about the current call stack, including function names and source locations. [Example](https://docs.volt.bz/docs/debug/getcallstack#example) ---------------------------------------------------------------- local function innerFunc() local stack = debug.getcallstack() for i, entry in ipairs(stack) do print(i, entry.name or "anonymous", entry.source) end end local function outerFunc() innerFunc() end outerFunc() [Entry Fields](https://docs.volt.bz/docs/debug/getcallstack#entry-fields) -------------------------------------------------------------------------- | Field | Description | | --- | --- | | `name` | Function name | | `source` | Source file/script | | `line` | Current line number | | `func` | The function itself | [Related Functions](https://docs.volt.bz/docs/debug/getcallstack#related-functions) ------------------------------------------------------------------------------------ * [`debug.getinfo`](https://docs.volt.bz/docs/debug/getinfo) - Get info for specific level * [`debug.validlevel`](https://docs.volt.bz/docs/debug/validlevel) - Check if level is valid [Debug\ \ Previous Page](https://docs.volt.bz/docs/debug) [debug.getconstant\ \ Next Page](https://docs.volt.bz/docs/debug/getconstant) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getcallstack#syntax) [Parameters](https://docs.volt.bz/docs/debug/getcallstack#parameters) [Returns](https://docs.volt.bz/docs/debug/getcallstack#returns) [Description](https://docs.volt.bz/docs/debug/getcallstack#description) [Example](https://docs.volt.bz/docs/debug/getcallstack#example) [Entry Fields](https://docs.volt.bz/docs/debug/getcallstack#entry-fields) [Related Functions](https://docs.volt.bz/docs/debug/getcallstack#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) getfunctionhash =============== Returns a hash of the function's bytecode. [Syntax](https://docs.volt.bz/docs/closures/getfunctionhash#syntax) -------------------------------------------------------------------- getfunctionhash(func: function) -> string [Parameters](https://docs.volt.bz/docs/closures/getfunctionhash#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to hash | [Returns](https://docs.volt.bz/docs/closures/getfunctionhash#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | A hash string representing the function's bytecode | [Description](https://docs.volt.bz/docs/closures/getfunctionhash#description) ------------------------------------------------------------------------------ `getfunctionhash` generates a unique hash based on the function's compiled bytecode. Functions with identical source code will produce the same hash, making this useful for identifying and comparing functions. [Example](https://docs.volt.bz/docs/closures/getfunctionhash#example) ---------------------------------------------------------------------- local function testFunc() return 1 + 1 end local hash = getfunctionhash(testFunc) print(hash) -- Output: something like "a1b2c3d4..." -- Same code produces same hash local function testFunc2() return 1 + 1 end print(getfunctionhash(testFunc2) == hash) -- true [Notes](https://docs.volt.bz/docs/closures/getfunctionhash#notes) ------------------------------------------------------------------ * Only works with Luau closures (not C closures) * Slight changes in function bytecode will alter the returned hash [clonefunction\ \ Previous Page](https://docs.volt.bz/docs/closures/clonefunction) [hookfunction\ \ Next Page](https://docs.volt.bz/docs/closures/hookfunction) ### On this page [Syntax](https://docs.volt.bz/docs/closures/getfunctionhash#syntax) [Parameters](https://docs.volt.bz/docs/closures/getfunctionhash#parameters) [Returns](https://docs.volt.bz/docs/closures/getfunctionhash#returns) [Description](https://docs.volt.bz/docs/closures/getfunctionhash#description) [Example](https://docs.volt.bz/docs/closures/getfunctionhash#example) [Notes](https://docs.volt.bz/docs/closures/getfunctionhash#notes) --- # Volt Documentation [Encoding](https://docs.volt.bz/docs/encoding) base64decode ============ Decodes a Base64 encoded string. [Syntax](https://docs.volt.bz/docs/encoding/base64decode#syntax) ----------------------------------------------------------------- base64decode(data: string) -> string [Parameters](https://docs.volt.bz/docs/encoding/base64decode#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The Base64 encoded string | [Returns](https://docs.volt.bz/docs/encoding/base64decode#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The decoded binary data | [Description](https://docs.volt.bz/docs/encoding/base64decode#description) --------------------------------------------------------------------------- `base64decode` converts a Base64 encoded string back to its original binary form. [Example](https://docs.volt.bz/docs/encoding/base64decode#example) ------------------------------------------------------------------- local encoded = "SGVsbG8sIFdvcmxkIQ==" local decoded = base64decode(encoded) print(decoded) -- "Hello, World!" [Round-trip Example](https://docs.volt.bz/docs/encoding/base64decode#round-trip-example) ----------------------------------------------------------------------------------------- local original = "This is a test message!" -- Encode then decode local encoded = base64encode(original) local decoded = base64decode(encoded) print(original == decoded) -- true [Use Cases](https://docs.volt.bz/docs/encoding/base64decode#use-cases) ----------------------------------------------------------------------- * **API responses**: Decode Base64 data from web APIs * **Embedded data**: Extract binary data from encoded strings * **Deserialization**: Decode stored or transmitted data [Related Functions](https://docs.volt.bz/docs/encoding/base64decode#related-functions) --------------------------------------------------------------------------------------- * [`base64encode`](https://docs.volt.bz/docs/encoding/base64encode) - Encode to Base64 [Aliases](https://docs.volt.bz/docs/encoding/base64decode#aliases) ------------------------------------------------------------------- * `base64_decode` [Encoding\ \ Previous Page](https://docs.volt.bz/docs/encoding) [base64encode\ \ Next Page](https://docs.volt.bz/docs/encoding/base64encode) ### On this page [Syntax](https://docs.volt.bz/docs/encoding/base64decode#syntax) [Parameters](https://docs.volt.bz/docs/encoding/base64decode#parameters) [Returns](https://docs.volt.bz/docs/encoding/base64decode#returns) [Description](https://docs.volt.bz/docs/encoding/base64decode#description) [Example](https://docs.volt.bz/docs/encoding/base64decode#example) [Round-trip Example](https://docs.volt.bz/docs/encoding/base64decode#round-trip-example) [Use Cases](https://docs.volt.bz/docs/encoding/base64decode#use-cases) [Related Functions](https://docs.volt.bz/docs/encoding/base64decode#related-functions) [Aliases](https://docs.volt.bz/docs/encoding/base64decode#aliases) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) setsimulationradius =================== Sets the player's network simulation radius. [Syntax](https://docs.volt.bz/docs/reflection/setsimulationradius#syntax) -------------------------------------------------------------------------- setsimulationradius(radius: number, maxRadius: number?) -> void [Parameters](https://docs.volt.bz/docs/reflection/setsimulationradius#parameters) ---------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `radius` | `number` | The simulation radius | | `maxRadius` | `number` | (Optional) Maximum radius | [Returns](https://docs.volt.bz/docs/reflection/setsimulationradius#returns) ---------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/reflection/setsimulationradius#description) ------------------------------------------------------------------------------------ `setsimulationradius` sets how far from the player physics simulation ownership extends. This affects network ownership of parts. [Example](https://docs.volt.bz/docs/reflection/setsimulationradius#example) ---------------------------------------------------------------------------- -- Set maximum simulation radius setsimulationradius(math.huge, math.huge) -- Now the player owns physics simulation for distant objects [Notes](https://docs.volt.bz/docs/reflection/setsimulationradius#notes) ------------------------------------------------------------------------ * Higher values give you ownership of more physics objects * Server can override network ownership * Used for physics manipulation [Related Functions](https://docs.volt.bz/docs/reflection/setsimulationradius#related-functions) ------------------------------------------------------------------------------------------------ * [`isnetworkowner`](https://docs.volt.bz/docs/reflection/isnetworkowner) - Check ownership [setscriptable\ \ Previous Page](https://docs.volt.bz/docs/reflection/setscriptable) [setthreadidentity\ \ Next Page](https://docs.volt.bz/docs/reflection/setthreadidentity) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/setsimulationradius#syntax) [Parameters](https://docs.volt.bz/docs/reflection/setsimulationradius#parameters) [Returns](https://docs.volt.bz/docs/reflection/setsimulationradius#returns) [Description](https://docs.volt.bz/docs/reflection/setsimulationradius#description) [Example](https://docs.volt.bz/docs/reflection/setsimulationradius#example) [Notes](https://docs.volt.bz/docs/reflection/setsimulationradius#notes) [Related Functions](https://docs.volt.bz/docs/reflection/setsimulationradius#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) readfile ======== Reads the contents of a file. [Syntax](https://docs.volt.bz/docs/filesystem/readfile#syntax) --------------------------------------------------------------- readfile(path: string) -> string [Parameters](https://docs.volt.bz/docs/filesystem/readfile#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path | [Returns](https://docs.volt.bz/docs/filesystem/readfile#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The file contents | [Description](https://docs.volt.bz/docs/filesystem/readfile#description) ------------------------------------------------------------------------- `readfile` reads and returns the entire contents of a file as a string. [Example](https://docs.volt.bz/docs/filesystem/readfile#example) ----------------------------------------------------------------- -- Write and then read a file writefile("message.txt", "Hello, World!") local content = readfile("message.txt") print(content) -- "Hello, World!" [Reading JSON](https://docs.volt.bz/docs/filesystem/readfile#reading-json) --------------------------------------------------------------------------- local HttpService = game:GetService("HttpService") -- Write JSON data local data = {name = "Player", score = 100} writefile("save.json", HttpService:JSONEncode(data)) -- Read and parse JSON local content = readfile("save.json") local loaded = HttpService:JSONDecode(content) print(loaded.name, loaded.score) -- "Player" 100 [Error Handling](https://docs.volt.bz/docs/filesystem/readfile#error-handling) ------------------------------------------------------------------------------- local function safeRead(path) local success, result = pcall(readfile, path) if success then return result else warn("Failed to read:", result) return nil end end [Related Functions](https://docs.volt.bz/docs/filesystem/readfile#related-functions) ------------------------------------------------------------------------------------- * [`writefile`](https://docs.volt.bz/docs/filesystem/writefile) - Write to a file * [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) - Check if file exists * [`loadfile`](https://docs.volt.bz/docs/filesystem/loadfile) - Load Lua file as function [makefolder\ \ Previous Page](https://docs.volt.bz/docs/filesystem/makefolder) [writefile\ \ Next Page](https://docs.volt.bz/docs/filesystem/writefile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/readfile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/readfile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/readfile#returns) [Description](https://docs.volt.bz/docs/filesystem/readfile#description) [Example](https://docs.volt.bz/docs/filesystem/readfile#example) [Reading JSON](https://docs.volt.bz/docs/filesystem/readfile#reading-json) [Error Handling](https://docs.volt.bz/docs/filesystem/readfile#error-handling) [Related Functions](https://docs.volt.bz/docs/filesystem/readfile#related-functions) --- # Volt Documentation [Drawing](https://docs.volt.bz/docs/drawing) getrenderproperty ================= Gets a property value from a drawing object. [Syntax](https://docs.volt.bz/docs/drawing/getrenderproperty#syntax) --------------------------------------------------------------------- getrenderproperty(drawing: Drawing, property: string) -> any [Parameters](https://docs.volt.bz/docs/drawing/getrenderproperty#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `drawing` | `Drawing` | The drawing object | | `property` | `string` | The property name | [Returns](https://docs.volt.bz/docs/drawing/getrenderproperty#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `any` | The value of the property | [Description](https://docs.volt.bz/docs/drawing/getrenderproperty#description) ------------------------------------------------------------------------------- `getrenderproperty` retrieves the current value of a property on a drawing object. This is an alternative to directly accessing properties. [Example](https://docs.volt.bz/docs/drawing/getrenderproperty#example) ----------------------------------------------------------------------- local circle = Drawing.new("Circle") circle.Position = Vector2.new(500, 500) circle.Radius = 100 circle.Color = Color3.fromRGB(255, 0, 0) circle.Visible = true -- Get properties using getrenderproperty local pos = getrenderproperty(circle, "Position") local radius = getrenderproperty(circle, "Radius") local color = getrenderproperty(circle, "Color") print(pos) -- 500, 500 print(radius) -- 100 print(color) -- 1, 0, 0 [Properties by Type](https://docs.volt.bz/docs/drawing/getrenderproperty#properties-by-type) --------------------------------------------------------------------------------------------- ### [Circle](https://docs.volt.bz/docs/drawing/getrenderproperty#circle) * `Position` (Vector2) * `Radius` (number) * `Filled` (boolean) * `Thickness` (number) ### [Line](https://docs.volt.bz/docs/drawing/getrenderproperty#line) * `From` (Vector2) * `To` (Vector2) * `Thickness` (number) ### [Text](https://docs.volt.bz/docs/drawing/getrenderproperty#text) * `Position` (Vector2) * `Text` (string) * `Size` (number) * `Font` (Drawing.Fonts) * `Center` (boolean) * `Outline` (boolean) [Related Functions](https://docs.volt.bz/docs/drawing/getrenderproperty#related-functions) ------------------------------------------------------------------------------------------- * [`setrenderproperty`](https://docs.volt.bz/docs/drawing/setrenderproperty) - Set a property * [`isrenderobj`](https://docs.volt.bz/docs/drawing/isrenderobj) - Check if value is a drawing [cleardrawcache\ \ Previous Page](https://docs.volt.bz/docs/drawing/cleardrawcache) [isrenderobj\ \ Next Page](https://docs.volt.bz/docs/drawing/isrenderobj) ### On this page [Syntax](https://docs.volt.bz/docs/drawing/getrenderproperty#syntax) [Parameters](https://docs.volt.bz/docs/drawing/getrenderproperty#parameters) [Returns](https://docs.volt.bz/docs/drawing/getrenderproperty#returns) [Description](https://docs.volt.bz/docs/drawing/getrenderproperty#description) [Example](https://docs.volt.bz/docs/drawing/getrenderproperty#example) [Properties by Type](https://docs.volt.bz/docs/drawing/getrenderproperty#properties-by-type) [Circle](https://docs.volt.bz/docs/drawing/getrenderproperty#circle) [Line](https://docs.volt.bz/docs/drawing/getrenderproperty#line) [Text](https://docs.volt.bz/docs/drawing/getrenderproperty#text) [Related Functions](https://docs.volt.bz/docs/drawing/getrenderproperty#related-functions) --- # Volt Documentation [Encoding](https://docs.volt.bz/docs/encoding) base64encode ============ Encodes data to Base64 format. [Syntax](https://docs.volt.bz/docs/encoding/base64encode#syntax) ----------------------------------------------------------------- base64encode(data: string) -> string [Parameters](https://docs.volt.bz/docs/encoding/base64encode#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The binary data to encode | [Returns](https://docs.volt.bz/docs/encoding/base64encode#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The Base64 encoded string | [Description](https://docs.volt.bz/docs/encoding/base64encode#description) --------------------------------------------------------------------------- `base64encode` converts binary data into a Base64 encoded string that contains only ASCII characters. [Example](https://docs.volt.bz/docs/encoding/base64encode#example) ------------------------------------------------------------------- local data = "Hello, World!" local encoded = base64encode(data) print(encoded) -- "SGVsbG8sIFdvcmxkIQ==" [Encoding Binary Data](https://docs.volt.bz/docs/encoding/base64encode#encoding-binary-data) --------------------------------------------------------------------------------------------- -- Encode binary data (like file contents) local binaryData = "\0\1\2\3\255\254" local encoded = base64encode(binaryData) print(encoded) -- Safe ASCII string [Use Cases](https://docs.volt.bz/docs/encoding/base64encode#use-cases) ----------------------------------------------------------------------- * **Data transmission**: Send binary data over text protocols * **Storage**: Store binary data in JSON or other text formats * **Obfuscation**: Light obfuscation of string data [Related Functions](https://docs.volt.bz/docs/encoding/base64encode#related-functions) --------------------------------------------------------------------------------------- * [`base64decode`](https://docs.volt.bz/docs/encoding/base64decode) - Decode from Base64 [Aliases](https://docs.volt.bz/docs/encoding/base64encode#aliases) ------------------------------------------------------------------- * `base64_encode` [base64decode\ \ Previous Page](https://docs.volt.bz/docs/encoding/base64decode) [lz4compress\ \ Next Page](https://docs.volt.bz/docs/encoding/lz4compress) ### On this page [Syntax](https://docs.volt.bz/docs/encoding/base64encode#syntax) [Parameters](https://docs.volt.bz/docs/encoding/base64encode#parameters) [Returns](https://docs.volt.bz/docs/encoding/base64encode#returns) [Description](https://docs.volt.bz/docs/encoding/base64encode#description) [Example](https://docs.volt.bz/docs/encoding/base64encode#example) [Encoding Binary Data](https://docs.volt.bz/docs/encoding/base64encode#encoding-binary-data) [Use Cases](https://docs.volt.bz/docs/encoding/base64encode#use-cases) [Related Functions](https://docs.volt.bz/docs/encoding/base64encode#related-functions) [Aliases](https://docs.volt.bz/docs/encoding/base64encode#aliases) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) filtergc ======== Filters objects in the garbage collector based on specified criteria. [Syntax](https://docs.volt.bz/docs/environment/filtergc#syntax) ---------------------------------------------------------------- filtergc(type: string, options: table) -> table [Parameters](https://docs.volt.bz/docs/environment/filtergc#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `type` | `string` | The type of object to find ("function" or "table") | | `options` | `table` | Filter options | [Returns](https://docs.volt.bz/docs/environment/filtergc#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `table` | Array of matching objects | [Description](https://docs.volt.bz/docs/environment/filtergc#description) -------------------------------------------------------------------------- `filtergc` efficiently searches through garbage-collected objects with specific filter criteria. This is more performant than manually iterating through `getgc()`. [Function Filter Options](https://docs.volt.bz/docs/environment/filtergc#function-filter-options) -------------------------------------------------------------------------------------------------- | Option | Type | Description | | --- | --- | --- | | `Name` | `string` | Match function name | | `Constants` | `table` | Match constants in function | | `Upvalues` | `table` | Match upvalue values | | `IgnoreExecutor` | `boolean` | Exclude volt functions | [Table Filter Options](https://docs.volt.bz/docs/environment/filtergc#table-filter-options) -------------------------------------------------------------------------------------------- | Option | Type | Description | | --- | --- | --- | | `Keys` | `table` | Match table keys | | `Values` | `table` | Match table values | | `KeyValuePairs` | `table` | Match key-value pairs | | `Metatable` | `table` | Match metatable | [Example: Find Function by Name](https://docs.volt.bz/docs/environment/filtergc#example-find-function-by-name) --------------------------------------------------------------------------------------------------------------- local functions = filtergc("function", { Name = "targetFunction" }) for _, func in ipairs(functions) do print("Found:", func) end [Example: Find Function by Constants](https://docs.volt.bz/docs/environment/filtergc#example-find-function-by-constants) ------------------------------------------------------------------------------------------------------------------------- local functions = filtergc("function", { Constants = {"SomeUniqueString", "AnotherString"} }) [Example: Find Table by Keys](https://docs.volt.bz/docs/environment/filtergc#example-find-table-by-keys) --------------------------------------------------------------------------------------------------------- local tables = filtergc("table", { Keys = {"Health", "MaxHealth", "Damage"} }) for _, tbl in ipairs(tables) do print("Found table with game stats") end [Example: Ignore Volt Functions](https://docs.volt.bz/docs/environment/filtergc#example-ignore-volt-functions) --------------------------------------------------------------------------------------------------------------- local gameFunctions = filtergc("function", { Name = "Update", IgnoreExecutor = true }) [Related Functions](https://docs.volt.bz/docs/environment/filtergc#related-functions) -------------------------------------------------------------------------------------- * [`getgc`](https://docs.volt.bz/docs/environment/getgc) - Get all GC objects [Environment\ \ Previous Page](https://docs.volt.bz/docs/environment) [getgc\ \ Next Page](https://docs.volt.bz/docs/environment/getgc) ### On this page [Syntax](https://docs.volt.bz/docs/environment/filtergc#syntax) [Parameters](https://docs.volt.bz/docs/environment/filtergc#parameters) [Returns](https://docs.volt.bz/docs/environment/filtergc#returns) [Description](https://docs.volt.bz/docs/environment/filtergc#description) [Function Filter Options](https://docs.volt.bz/docs/environment/filtergc#function-filter-options) [Table Filter Options](https://docs.volt.bz/docs/environment/filtergc#table-filter-options) [Example: Find Function by Name](https://docs.volt.bz/docs/environment/filtergc#example-find-function-by-name) [Example: Find Function by Constants](https://docs.volt.bz/docs/environment/filtergc#example-find-function-by-constants) [Example: Find Table by Keys](https://docs.volt.bz/docs/environment/filtergc#example-find-table-by-keys) [Example: Ignore Volt Functions](https://docs.volt.bz/docs/environment/filtergc#example-ignore-volt-functions) [Related Functions](https://docs.volt.bz/docs/environment/filtergc#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.encrypt ============= Encrypts data using a specified algorithm and key. [Syntax](https://docs.volt.bz/docs/crypt/encrypt#syntax) --------------------------------------------------------- crypt.encrypt(data: string, key: string, iv: string?, algorithm: string?) -> string [Parameters](https://docs.volt.bz/docs/crypt/encrypt#parameters) ----------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The data to encrypt | | `key` | `string` | The encryption key | | `iv` | `string` | (Optional) Initialization vector | | `algorithm` | `string` | (Optional) Algorithm, defaults to "AES-CBC" | [Returns](https://docs.volt.bz/docs/crypt/encrypt#returns) ----------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The encrypted data | [Description](https://docs.volt.bz/docs/crypt/encrypt#description) ------------------------------------------------------------------- `crypt.encrypt` encrypts the provided data using the specified algorithm and key. The result is typically Base64-encoded. [Supported Algorithms](https://docs.volt.bz/docs/crypt/encrypt#supported-algorithms) ------------------------------------------------------------------------------------- * `AES-CBC` (default) * `AES-GCM` * `AES-CTR` [Example](https://docs.volt.bz/docs/crypt/encrypt#example) ----------------------------------------------------------- local key = crypt.generatekey() local data = "Secret message" -- Encrypt with default algorithm local encrypted = crypt.encrypt(data, key) print("Encrypted:", encrypted) -- Decrypt to verify local decrypted = crypt.decrypt(encrypted, key) print("Decrypted:", decrypted) [With Custom IV](https://docs.volt.bz/docs/crypt/encrypt#with-custom-iv) ------------------------------------------------------------------------- local key = crypt.generatekey() local iv = crypt.generatebytes(16) local data = "Secret message" local encrypted = crypt.encrypt(data, key, iv, "AES-CBC") local decrypted = crypt.decrypt(encrypted, key, iv, "AES-CBC") [Related Functions](https://docs.volt.bz/docs/crypt/encrypt#related-functions) ------------------------------------------------------------------------------- * [`crypt.decrypt`](https://docs.volt.bz/docs/crypt/decrypt) - Decrypt data * [`crypt.generatekey`](https://docs.volt.bz/docs/crypt/generatekey) - Generate a key [crypt.decrypt\ \ Previous Page](https://docs.volt.bz/docs/crypt/decrypt) [crypt.generatebytes\ \ Next Page](https://docs.volt.bz/docs/crypt/generatebytes) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/encrypt#syntax) [Parameters](https://docs.volt.bz/docs/crypt/encrypt#parameters) [Returns](https://docs.volt.bz/docs/crypt/encrypt#returns) [Description](https://docs.volt.bz/docs/crypt/encrypt#description) [Supported Algorithms](https://docs.volt.bz/docs/crypt/encrypt#supported-algorithms) [Example](https://docs.volt.bz/docs/crypt/encrypt#example) [With Custom IV](https://docs.volt.bz/docs/crypt/encrypt#with-custom-iv) [Related Functions](https://docs.volt.bz/docs/crypt/encrypt#related-functions) --- # Volt Documentation [Drawing](https://docs.volt.bz/docs/drawing) isrenderobj =========== Checks if a value is a drawing object. [Syntax](https://docs.volt.bz/docs/drawing/isrenderobj#syntax) --------------------------------------------------------------- isrenderobj(value: any) -> boolean [Parameters](https://docs.volt.bz/docs/drawing/isrenderobj#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `value` | `any` | The value to check | [Returns](https://docs.volt.bz/docs/drawing/isrenderobj#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the value is a drawing object | [Description](https://docs.volt.bz/docs/drawing/isrenderobj#description) ------------------------------------------------------------------------- `isrenderobj` determines whether a given value is a valid drawing object created by `Drawing.new()`. [Example](https://docs.volt.bz/docs/drawing/isrenderobj#example) ----------------------------------------------------------------- local circle = Drawing.new("Circle") local normalTable = {} local number = 123 print(isrenderobj(circle)) -- true print(isrenderobj(normalTable)) -- false print(isrenderobj(number)) -- false print(isrenderobj(nil)) -- false [Use Cases](https://docs.volt.bz/docs/drawing/isrenderobj#use-cases) --------------------------------------------------------------------- * **Validation**: Verify that a value is a drawing before manipulating it * **Cleanup**: Filter drawing objects from a mixed table * **Debugging**: Identify the type of unknown values [Example: Safe Removal](https://docs.volt.bz/docs/drawing/isrenderobj#example-safe-removal) -------------------------------------------------------------------------------------------- local function safeRemove(obj) if isrenderobj(obj) then obj:Remove() return true end return false end [Related Functions](https://docs.volt.bz/docs/drawing/isrenderobj#related-functions) ------------------------------------------------------------------------------------- * [`getrenderproperty`](https://docs.volt.bz/docs/drawing/getrenderproperty) - Get a drawing property * [`setrenderproperty`](https://docs.volt.bz/docs/drawing/setrenderproperty) - Set a drawing property [getrenderproperty\ \ Previous Page](https://docs.volt.bz/docs/drawing/getrenderproperty) [setrenderproperty\ \ Next Page](https://docs.volt.bz/docs/drawing/setrenderproperty) ### On this page [Syntax](https://docs.volt.bz/docs/drawing/isrenderobj#syntax) [Parameters](https://docs.volt.bz/docs/drawing/isrenderobj#parameters) [Returns](https://docs.volt.bz/docs/drawing/isrenderobj#returns) [Description](https://docs.volt.bz/docs/drawing/isrenderobj#description) [Example](https://docs.volt.bz/docs/drawing/isrenderobj#example) [Use Cases](https://docs.volt.bz/docs/drawing/isrenderobj#use-cases) [Example: Safe Removal](https://docs.volt.bz/docs/drawing/isrenderobj#example-safe-removal) [Related Functions](https://docs.volt.bz/docs/drawing/isrenderobj#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mousemoveabs ============ Moves the mouse cursor to an absolute screen position. [Syntax](https://docs.volt.bz/docs/input/mousemoveabs#syntax) -------------------------------------------------------------- mousemoveabs(x: number, y: number) -> void [Parameters](https://docs.volt.bz/docs/input/mousemoveabs#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `x` | `number` | X coordinate in pixels | | `y` | `number` | Y coordinate in pixels | [Returns](https://docs.volt.bz/docs/input/mousemoveabs#returns) ---------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mousemoveabs#description) ------------------------------------------------------------------------ `mousemoveabs` moves the mouse cursor to the specified absolute screen coordinates. [Example](https://docs.volt.bz/docs/input/mousemoveabs#example) ---------------------------------------------------------------- -- Move to top-left corner mousemoveabs(0, 0) -- Move to center of screen (assuming 1920x1080) mousemoveabs(960, 540) -- Move to specific button location mousemoveabs(500, 300) mouse1click() [Related Functions](https://docs.volt.bz/docs/input/mousemoveabs#related-functions) ------------------------------------------------------------------------------------ * [`mousemoverel`](https://docs.volt.bz/docs/input/mousemoverel) - Move relative to current position [mouse2release\ \ Previous Page](https://docs.volt.bz/docs/input/mouse2release) [mousemoverel\ \ Next Page](https://docs.volt.bz/docs/input/mousemoverel) ### On this page [Syntax](https://docs.volt.bz/docs/input/mousemoveabs#syntax) [Parameters](https://docs.volt.bz/docs/input/mousemoveabs#parameters) [Returns](https://docs.volt.bz/docs/input/mousemoveabs#returns) [Description](https://docs.volt.bz/docs/input/mousemoveabs#description) [Example](https://docs.volt.bz/docs/input/mousemoveabs#example) [Related Functions](https://docs.volt.bz/docs/input/mousemoveabs#related-functions) --- # Volt Documentation [Encoding](https://docs.volt.bz/docs/encoding) lz4compress =========== Compresses data using the LZ4 algorithm. [Syntax](https://docs.volt.bz/docs/encoding/lz4compress#syntax) ---------------------------------------------------------------- lz4compress(data: string) -> string [Parameters](https://docs.volt.bz/docs/encoding/lz4compress#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The data to compress | [Returns](https://docs.volt.bz/docs/encoding/lz4compress#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `string` | The LZ4 compressed data | [Description](https://docs.volt.bz/docs/encoding/lz4compress#description) -------------------------------------------------------------------------- `lz4compress` compresses a string using the LZ4 compression algorithm. LZ4 is optimized for speed over compression ratio, making it ideal for real-time applications. [Example](https://docs.volt.bz/docs/encoding/lz4compress#example) ------------------------------------------------------------------ local data = string.rep("Hello, World! ", 1000) print("Original size:", #data) -- 14000 local compressed = lz4compress(data) print("Compressed size:", #compressed) -- Much smaller local decompressed = lz4decompress(compressed, #data) print(data == decompressed) -- true [Compression Ratio](https://docs.volt.bz/docs/encoding/lz4compress#compression-ratio) -------------------------------------------------------------------------------------- LZ4 works best with: * Repetitive data * Text with patterns * Structured data -- High compression (repetitive data) local repetitive = string.rep("AAAA", 10000) local comp1 = lz4compress(repetitive) print(#comp1 / #repetitive) -- Very small ratio -- Lower compression (random data) local random = "" for i = 1, 1000 do random = random .. string.char(math.random(0, 255)) end local comp2 = lz4compress(random) print(#comp2 / #random) -- Closer to 1 [Related Functions](https://docs.volt.bz/docs/encoding/lz4compress#related-functions) -------------------------------------------------------------------------------------- * [`lz4decompress`](https://docs.volt.bz/docs/encoding/lz4decompress) - Decompress LZ4 data [base64encode\ \ Previous Page](https://docs.volt.bz/docs/encoding/base64encode) [lz4decompress\ \ Next Page](https://docs.volt.bz/docs/encoding/lz4decompress) ### On this page [Syntax](https://docs.volt.bz/docs/encoding/lz4compress#syntax) [Parameters](https://docs.volt.bz/docs/encoding/lz4compress#parameters) [Returns](https://docs.volt.bz/docs/encoding/lz4compress#returns) [Description](https://docs.volt.bz/docs/encoding/lz4compress#description) [Example](https://docs.volt.bz/docs/encoding/lz4compress#example) [Compression Ratio](https://docs.volt.bz/docs/encoding/lz4compress#compression-ratio) [Related Functions](https://docs.volt.bz/docs/encoding/lz4compress#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) saveplace ========= Saves the current place to a file. [Syntax](https://docs.volt.bz/docs/miscellaneous/saveplace#syntax) ------------------------------------------------------------------- saveplace(filename: string?) -> void [Parameters](https://docs.volt.bz/docs/miscellaneous/saveplace#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `filename` | `string` | (Optional) Output file name | [Returns](https://docs.volt.bz/docs/miscellaneous/saveplace#returns) --------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/saveplace#description) ----------------------------------------------------------------------------- `saveplace` is a shorthand for `saveinstance` that saves the entire game to a file. [Example](https://docs.volt.bz/docs/miscellaneous/saveplace#example) --------------------------------------------------------------------- -- Save with default name saveplace() -- Save with custom name saveplace("MyGame.rbxl") [Notes](https://docs.volt.bz/docs/miscellaneous/saveplace#notes) ----------------------------------------------------------------- * Saves to the workspace folder * Equivalent to `saveinstance({FilePath = filename})` [Related Functions](https://docs.volt.bz/docs/miscellaneous/saveplace#related-functions) ----------------------------------------------------------------------------------------- * [`saveinstance`](https://docs.volt.bz/docs/miscellaneous/saveinstance) - Full save with options [saveinstance\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/saveinstance) [setclipboard\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/setclipboard) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/saveplace#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/saveplace#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/saveplace#returns) [Description](https://docs.volt.bz/docs/miscellaneous/saveplace#description) [Example](https://docs.volt.bz/docs/miscellaneous/saveplace#example) [Notes](https://docs.volt.bz/docs/miscellaneous/saveplace#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/saveplace#related-functions) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy.Event =================== Generic event for communication between Lua states. [Syntax](https://docs.volt.bz/docs/luastateproxy/event#syntax) --------------------------------------------------------------- state.Event: VoltSignal [Description](https://docs.volt.bz/docs/luastateproxy/event#description) ------------------------------------------------------------------------- `LuaStateProxy.Event` is a `VoltSignal` property that allows communication between different Lua states. You can connect handlers to listen for events and fire events to send messages to other states. [Example](https://docs.volt.bz/docs/luastateproxy/event#example) ----------------------------------------------------------------- local state = getluastate() -- Listen for events state.Event:Connect(function(message) print("Received:", message) end) -- Fire an event state.Event:Fire("Hello from this state!") [Cross-State Communication](https://docs.volt.bz/docs/luastateproxy/event#cross-state-communication) ----------------------------------------------------------------------------------------------------- local gameState = getgamestate() local actorState = getluastate(someActor) -- Listen on game state gameState.Event:Connect(function(message, senderId) print("Game state received:", message, "from state", senderId) end) -- Fire from actor state actorState.Event:Fire("Hello from actor!", actorState.Id) [Broadcast to All States](https://docs.volt.bz/docs/luastateproxy/event#broadcast-to-all-states) ------------------------------------------------------------------------------------------------- local states = getactorstates() -- Broadcast to all actor states for _, state in ipairs(states) do if state.IsActorState then state.Event:Fire("Broadcast message") end end [Related Properties](https://docs.volt.bz/docs/luastateproxy/event#related-properties) --------------------------------------------------------------------------------------- * [`LuaStateProxy.Id`](https://docs.volt.bz/docs/luastateproxy/id) - State identifier for message routing * [`VoltSignal`](https://docs.volt.bz/docs/voltsignal) - Signal implementation documentation [LuaStateProxy\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy) [LuaStateProxy:Execute\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/execute) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/event#syntax) [Description](https://docs.volt.bz/docs/luastateproxy/event#description) [Example](https://docs.volt.bz/docs/luastateproxy/event#example) [Cross-State Communication](https://docs.volt.bz/docs/luastateproxy/event#cross-state-communication) [Broadcast to All States](https://docs.volt.bz/docs/luastateproxy/event#broadcast-to-all-states) [Related Properties](https://docs.volt.bz/docs/luastateproxy/event#related-properties) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) getgc ===== Returns a table of all objects tracked by the garbage collector. [Syntax](https://docs.volt.bz/docs/environment/getgc#syntax) ------------------------------------------------------------- getgc(includeTables?: boolean) -> table [Parameters](https://docs.volt.bz/docs/environment/getgc#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `includeTables` | `boolean?` | Whether to include tables (default: false) | [Returns](https://docs.volt.bz/docs/environment/getgc#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of all GC-tracked objects | [Description](https://docs.volt.bz/docs/environment/getgc#description) ----------------------------------------------------------------------- `getgc` returns all objects currently tracked by Luau's garbage collector. This is useful for finding specific functions, tables, or other objects in memory. [Example](https://docs.volt.bz/docs/environment/getgc#example) --------------------------------------------------------------- -- Get all functions in memory for _, obj in ipairs(getgc()) do if type(obj) == "function" then print("Found function:", obj) end end [Finding Specific Functions](https://docs.volt.bz/docs/environment/getgc#finding-specific-functions) ----------------------------------------------------------------------------------------------------- -- Find a function by its constants local function findFunction(targetString) for _, obj in ipairs(getgc()) do if type(obj) == "function" then local constants = debug.getconstants(obj) for _, const in ipairs(constants) do if const == targetString then return obj end end end end return nil end local targetFunc = findFunction("SomeUniqueString") [Including Tables](https://docs.volt.bz/docs/environment/getgc#including-tables) --------------------------------------------------------------------------------- -- Get all tables (slower, more results) local allObjects = getgc(true) for _, obj in ipairs(allObjects) do if type(obj) == "table" and obj.SpecialKey then print("Found target table!") end end [Notes](https://docs.volt.bz/docs/environment/getgc#notes) ----------------------------------------------------------- * Without `includeTables`, only functions and other non-table objects are returned * Including tables can be slow due to the large number of tables in memory * Consider using `filtergc` for more targeted searches [Related Functions](https://docs.volt.bz/docs/environment/getgc#related-functions) ----------------------------------------------------------------------------------- * [`filtergc`](https://docs.volt.bz/docs/environment/filtergc) - Filter objects with conditions [filtergc\ \ Previous Page](https://docs.volt.bz/docs/environment/filtergc) [getgenv\ \ Next Page](https://docs.volt.bz/docs/environment/getgenv) ### On this page [Syntax](https://docs.volt.bz/docs/environment/getgc#syntax) [Parameters](https://docs.volt.bz/docs/environment/getgc#parameters) [Returns](https://docs.volt.bz/docs/environment/getgc#returns) [Description](https://docs.volt.bz/docs/environment/getgc#description) [Example](https://docs.volt.bz/docs/environment/getgc#example) [Finding Specific Functions](https://docs.volt.bz/docs/environment/getgc#finding-specific-functions) [Including Tables](https://docs.volt.bz/docs/environment/getgc#including-tables) [Notes](https://docs.volt.bz/docs/environment/getgc#notes) [Related Functions](https://docs.volt.bz/docs/environment/getgc#related-functions) --- # Volt Documentation [oth](https://docs.volt.bz/docs/oth) get\_original\_thread ===================== Returns the original thread associated with the hook, or nil if not in a hook thread. [Syntax](https://docs.volt.bz/docs/oth/get_original_thread#syntax) ------------------------------------------------------------------- get_original_thread() -> thread? [Returns](https://docs.volt.bz/docs/oth/get_original_thread#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `thread?` | The original thread, or nil if not in a hook thread | [Description](https://docs.volt.bz/docs/oth/get_original_thread#description) ----------------------------------------------------------------------------- `get_original_thread` returns the original thread that called the hooked function. This is useful for accessing thread-local data or resuming execution on the original thread. [Example](https://docs.volt.bz/docs/oth/get_original_thread#example) --------------------------------------------------------------------- local originalPrint = oth.hook(print, function(...) local originalThread = get_original_thread() if originalThread then print("Original thread:", originalThread) print("Arguments:", ...) end return originalPrint(...) end) print("Test") [Thread Context](https://docs.volt.bz/docs/oth/get_original_thread#thread-context) ----------------------------------------------------------------------------------- local originalFunc = oth.hook(someCFunction, function(...) local originalThread = get_original_thread() if originalThread then -- We're in a hook thread print("Hook thread, original:", originalThread) -- Access thread-local data if needed else -- Not in a hook thread print("Not in hook thread") end return originalFunc(...) end) [Notes](https://docs.volt.bz/docs/oth/get_original_thread#notes) ----------------------------------------------------------------- * Returns `nil` if not currently executing in a hook thread * The returned thread is the one that originally called the hooked function * Useful for thread-local data access or debugging [Related Functions](https://docs.volt.bz/docs/oth/get_original_thread#related-functions) ----------------------------------------------------------------------------------------- * [`oth.hook`](https://docs.volt.bz/docs/oth/hook) - Create a hook * [`oth.is_hook_thread`](https://docs.volt.bz/docs/oth/is_hook_thread) - Check if in a hook thread [oth\ \ Previous Page](https://docs.volt.bz/docs/oth) [oth.get\_root\_callback\ \ Next Page](https://docs.volt.bz/docs/oth/get_root_callback) ### On this page [Syntax](https://docs.volt.bz/docs/oth/get_original_thread#syntax) [Returns](https://docs.volt.bz/docs/oth/get_original_thread#returns) [Description](https://docs.volt.bz/docs/oth/get_original_thread#description) [Example](https://docs.volt.bz/docs/oth/get_original_thread#example) [Thread Context](https://docs.volt.bz/docs/oth/get_original_thread#thread-context) [Notes](https://docs.volt.bz/docs/oth/get_original_thread#notes) [Related Functions](https://docs.volt.bz/docs/oth/get_original_thread#related-functions) --- # Volt Documentation [oth](https://docs.volt.bz/docs/oth) oth.get\_root\_callback ======================= Returns the original function, even after multiple hooks. [Syntax](https://docs.volt.bz/docs/oth/get_root_callback#syntax) ----------------------------------------------------------------- oth.get_root_callback(target: function) -> function? [Parameters](https://docs.volt.bz/docs/oth/get_root_callback#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `target` | `function` | The hooked function | [Returns](https://docs.volt.bz/docs/oth/get_root_callback#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `function?` | The original function, or nil if not found | [Description](https://docs.volt.bz/docs/oth/get_root_callback#description) --------------------------------------------------------------------------- `oth.get_root_callback` returns the original function that was hooked, even if multiple hooks have been applied. This allows you to bypass all hooks and call the true original function. [Example](https://docs.volt.bz/docs/oth/get_root_callback#example) ------------------------------------------------------------------- -- Hook a function multiple times local hook1 = oth.hook(someCFunction, function(...) print("Hook 1") return hook1(...) end) local hook2 = oth.hook(someCFunction, function(...) print("Hook 2") return hook2(...) end) -- Get the original, bypassing all hooks local original = oth.get_root_callback(someCFunction) original("test") -- Calls the true original, bypassing both hooks [Bypass All Hooks](https://docs.volt.bz/docs/oth/get_root_callback#bypass-all-hooks) ------------------------------------------------------------------------------------- local hookedFunc = oth.hook(print, function(...) print("[HOOKED]", ...) end) -- Get original to bypass hook local original = oth.get_root_callback(print) if original then original("Direct call") -- Bypasses the hook end [Notes](https://docs.volt.bz/docs/oth/get_root_callback#notes) --------------------------------------------------------------- * Returns `nil` if the function was never hooked or is not a C function * Always returns the true original, regardless of how many hooks exist * Useful for completely bypassing all hook layers [Related Functions](https://docs.volt.bz/docs/oth/get_root_callback#related-functions) --------------------------------------------------------------------------------------- * [`oth.hook`](https://docs.volt.bz/docs/oth/hook) - Create a hook * [`oth.unhook`](https://docs.volt.bz/docs/oth/unhook) - Remove a hook [get\_original\_thread\ \ Previous Page](https://docs.volt.bz/docs/oth/get_original_thread) [oth.hook\ \ Next Page](https://docs.volt.bz/docs/oth/hook) ### On this page [Syntax](https://docs.volt.bz/docs/oth/get_root_callback#syntax) [Parameters](https://docs.volt.bz/docs/oth/get_root_callback#parameters) [Returns](https://docs.volt.bz/docs/oth/get_root_callback#returns) [Description](https://docs.volt.bz/docs/oth/get_root_callback#description) [Example](https://docs.volt.bz/docs/oth/get_root_callback#example) [Bypass All Hooks](https://docs.volt.bz/docs/oth/get_root_callback#bypass-all-hooks) [Notes](https://docs.volt.bz/docs/oth/get_root_callback#notes) [Related Functions](https://docs.volt.bz/docs/oth/get_root_callback#related-functions) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getscripts ========== Returns all scripts in the game. [Syntax](https://docs.volt.bz/docs/scripts/getscripts#syntax) -------------------------------------------------------------- getscripts() -> table [Returns](https://docs.volt.bz/docs/scripts/getscripts#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of all scripts | [Description](https://docs.volt.bz/docs/scripts/getscripts#description) ------------------------------------------------------------------------ `getscripts` returns all script instances in the game, including LocalScripts, Scripts, and ModuleScripts. [Example](https://docs.volt.bz/docs/scripts/getscripts#example) ---------------------------------------------------------------- local scripts = getscripts() print("Total scripts:", #scripts) -- Count by type local counts = {LocalScript = 0, ModuleScript = 0, Script = 0} for _, script in ipairs(scripts) do local class = script.ClassName counts[class] = (counts[class] or 0) + 1 end for class, count in pairs(counts) do print(class, count) end [Finding Specific Scripts](https://docs.volt.bz/docs/scripts/getscripts#finding-specific-scripts) -------------------------------------------------------------------------------------------------- local function findScript(name) for _, script in ipairs(getscripts()) do if script.Name == name then return script end end return nil end local mainScript = findScript("MainLocalScript") if mainScript then print("Found:", mainScript:GetFullName()) end [Related Functions](https://docs.volt.bz/docs/scripts/getscripts#related-functions) ------------------------------------------------------------------------------------ * [`getrunningscripts`](https://docs.volt.bz/docs/scripts/getrunningscripts) - Get only running scripts * [`getloadedmodules`](https://docs.volt.bz/docs/scripts/getloadedmodules) - Get only loaded modules [getscripthash\ \ Previous Page](https://docs.volt.bz/docs/scripts/getscripthash) [getsenv\ \ Next Page](https://docs.volt.bz/docs/scripts/getsenv) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getscripts#syntax) [Returns](https://docs.volt.bz/docs/scripts/getscripts#returns) [Description](https://docs.volt.bz/docs/scripts/getscripts#description) [Example](https://docs.volt.bz/docs/scripts/getscripts#example) [Finding Specific Scripts](https://docs.volt.bz/docs/scripts/getscripts#finding-specific-scripts) [Related Functions](https://docs.volt.bz/docs/scripts/getscripts#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) setthreadidentity ================= Sets the current thread's identity level. [Syntax](https://docs.volt.bz/docs/reflection/setthreadidentity#syntax) ------------------------------------------------------------------------ setthreadidentity(identity: number) -> void [Parameters](https://docs.volt.bz/docs/reflection/setthreadidentity#parameters) -------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `identity` | `number` | The identity level (1-8) | [Returns](https://docs.volt.bz/docs/reflection/setthreadidentity#returns) -------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/reflection/setthreadidentity#description) ---------------------------------------------------------------------------------- `setthreadidentity` changes the identity level of the current thread, which affects what APIs and properties are accessible. [Example](https://docs.volt.bz/docs/reflection/setthreadidentity#example) -------------------------------------------------------------------------- -- Check current identity print("Before:", getthreadidentity()) -- Elevate identity setthreadidentity(8) print("After:", getthreadidentity()) -- Perform restricted operations here [Safe Identity Change](https://docs.volt.bz/docs/reflection/setthreadidentity#safe-identity-change) ---------------------------------------------------------------------------------------------------- local function withIdentity(level, callback) local original = getthreadidentity() setthreadidentity(level) local success, result = pcall(callback) setthreadidentity(original) if not success then error(result) end return result end -- Use elevated identity temporarily local result = withIdentity(8, function() -- Restricted operations here return "done" end) [Notes](https://docs.volt.bz/docs/reflection/setthreadidentity#notes) ---------------------------------------------------------------------- * Higher identity gives more permissions * Some operations require specific identity levels * Always restore original identity when done [Related Functions](https://docs.volt.bz/docs/reflection/setthreadidentity#related-functions) ---------------------------------------------------------------------------------------------- * [`getthreadidentity`](https://docs.volt.bz/docs/reflection/getthreadidentity) - Get current identity [Aliases](https://docs.volt.bz/docs/reflection/setthreadidentity#aliases) -------------------------------------------------------------------------- * `setidentity` * `setthreadcontext` [setsimulationradius\ \ Previous Page](https://docs.volt.bz/docs/reflection/setsimulationradius) [Scripts\ \ Next Page](https://docs.volt.bz/docs/scripts) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/setthreadidentity#syntax) [Parameters](https://docs.volt.bz/docs/reflection/setthreadidentity#parameters) [Returns](https://docs.volt.bz/docs/reflection/setthreadidentity#returns) [Description](https://docs.volt.bz/docs/reflection/setthreadidentity#description) [Example](https://docs.volt.bz/docs/reflection/setthreadidentity#example) [Safe Identity Change](https://docs.volt.bz/docs/reflection/setthreadidentity#safe-identity-change) [Notes](https://docs.volt.bz/docs/reflection/setthreadidentity#notes) [Related Functions](https://docs.volt.bz/docs/reflection/setthreadidentity#related-functions) [Aliases](https://docs.volt.bz/docs/reflection/setthreadidentity#aliases) --- # Volt Documentation [Drawing](https://docs.volt.bz/docs/drawing) setrenderproperty ================= Sets a property value on a drawing object. [Syntax](https://docs.volt.bz/docs/drawing/setrenderproperty#syntax) --------------------------------------------------------------------- setrenderproperty(drawing: Drawing, property: string, value: any) -> void [Parameters](https://docs.volt.bz/docs/drawing/setrenderproperty#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `drawing` | `Drawing` | The drawing object | | `property` | `string` | The property name | | `value` | `any` | The new value | [Returns](https://docs.volt.bz/docs/drawing/setrenderproperty#returns) ----------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/drawing/setrenderproperty#description) ------------------------------------------------------------------------------- `setrenderproperty` sets the value of a property on a drawing object. This is an alternative to directly assigning properties. [Example](https://docs.volt.bz/docs/drawing/setrenderproperty#example) ----------------------------------------------------------------------- local text = Drawing.new("Text") -- Set properties using setrenderproperty setrenderproperty(text, "Position", Vector2.new(100, 100)) setrenderproperty(text, "Text", "Hello, World!") setrenderproperty(text, "Size", 24) setrenderproperty(text, "Color", Color3.fromRGB(255, 255, 255)) setrenderproperty(text, "Outline", true) setrenderproperty(text, "Visible", true) [Batch Updates](https://docs.volt.bz/docs/drawing/setrenderproperty#batch-updates) ----------------------------------------------------------------------------------- local function updateDrawing(drawing, properties) for property, value in pairs(properties) do setrenderproperty(drawing, property, value) end end local circle = Drawing.new("Circle") updateDrawing(circle, { Position = Vector2.new(400, 300), Radius = 50, Color = Color3.fromRGB(0, 255, 0), Filled = true, Visible = true }) [Related Functions](https://docs.volt.bz/docs/drawing/setrenderproperty#related-functions) ------------------------------------------------------------------------------------------- * [`getrenderproperty`](https://docs.volt.bz/docs/drawing/getrenderproperty) - Get a property * [`isrenderobj`](https://docs.volt.bz/docs/drawing/isrenderobj) - Check if value is a drawing [isrenderobj\ \ Previous Page](https://docs.volt.bz/docs/drawing/isrenderobj) [Encoding\ \ Next Page](https://docs.volt.bz/docs/encoding) ### On this page [Syntax](https://docs.volt.bz/docs/drawing/setrenderproperty#syntax) [Parameters](https://docs.volt.bz/docs/drawing/setrenderproperty#parameters) [Returns](https://docs.volt.bz/docs/drawing/setrenderproperty#returns) [Description](https://docs.volt.bz/docs/drawing/setrenderproperty#description) [Example](https://docs.volt.bz/docs/drawing/setrenderproperty#example) [Batch Updates](https://docs.volt.bz/docs/drawing/setrenderproperty#batch-updates) [Related Functions](https://docs.volt.bz/docs/drawing/setrenderproperty#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.generatebytes =================== Generates cryptographically secure random bytes. [Syntax](https://docs.volt.bz/docs/crypt/generatebytes#syntax) --------------------------------------------------------------- crypt.generatebytes(length: number) -> string [Parameters](https://docs.volt.bz/docs/crypt/generatebytes#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `length` | `number` | Number of bytes to generate | [Returns](https://docs.volt.bz/docs/crypt/generatebytes#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | Random bytes (raw string) | [Description](https://docs.volt.bz/docs/crypt/generatebytes#description) ------------------------------------------------------------------------- `crypt.generatebytes` generates cryptographically secure random bytes, useful for creating initialization vectors, salts, or other random data. [Example](https://docs.volt.bz/docs/crypt/generatebytes#example) ----------------------------------------------------------------- -- Generate 16 bytes for an IV local iv = crypt.generatebytes(16) -- Generate 32 bytes for a salt local salt = crypt.generatebytes(32) [Related Functions](https://docs.volt.bz/docs/crypt/generatebytes#related-functions) ------------------------------------------------------------------------------------- * [`crypt.random`](https://docs.volt.bz/docs/crypt/random) - Same functionality * [`crypt.generatekey`](https://docs.volt.bz/docs/crypt/generatekey) - Generate encryption key [crypt.encrypt\ \ Previous Page](https://docs.volt.bz/docs/crypt/encrypt) [crypt.generatekey\ \ Next Page](https://docs.volt.bz/docs/crypt/generatekey) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/generatebytes#syntax) [Parameters](https://docs.volt.bz/docs/crypt/generatebytes#parameters) [Returns](https://docs.volt.bz/docs/crypt/generatebytes#returns) [Description](https://docs.volt.bz/docs/crypt/generatebytes#description) [Example](https://docs.volt.bz/docs/crypt/generatebytes#example) [Related Functions](https://docs.volt.bz/docs/crypt/generatebytes#related-functions) --- # Volt Documentation [Encoding](https://docs.volt.bz/docs/encoding) lz4decompress ============= Decompresses LZ4 compressed data. [Syntax](https://docs.volt.bz/docs/encoding/lz4decompress#syntax) ------------------------------------------------------------------ lz4decompress(data: string, size: number) -> string [Parameters](https://docs.volt.bz/docs/encoding/lz4decompress#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The LZ4 compressed data | | `size` | `number` | The original uncompressed size | [Returns](https://docs.volt.bz/docs/encoding/lz4decompress#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The decompressed data | [Description](https://docs.volt.bz/docs/encoding/lz4decompress#description) ---------------------------------------------------------------------------- `lz4decompress` decompresses data that was compressed with `lz4compress`. You must provide the original uncompressed size for the decompression to work correctly. [Example](https://docs.volt.bz/docs/encoding/lz4decompress#example) -------------------------------------------------------------------- local original = "This is the original data that will be compressed!" local originalSize = #original -- Compress local compressed = lz4compress(original) -- Decompress (need to know original size) local decompressed = lz4decompress(compressed, originalSize) print(original == decompressed) -- true [Storing Size with Data](https://docs.volt.bz/docs/encoding/lz4decompress#storing-size-with-data) -------------------------------------------------------------------------------------------------- When storing compressed data, you should also store the original size: local function compressWithSize(data) local compressed = lz4compress(data) -- Prepend the size as a 4-byte integer local size = #data return string.pack(" () [Parameters](https://docs.volt.bz/docs/websocket/close#parameters) ------------------------------------------------------------------- This method takes no parameters. [Returns](https://docs.volt.bz/docs/websocket/close#returns) ------------------------------------------------------------- This method does not return a value. [Description](https://docs.volt.bz/docs/websocket/close#description) --------------------------------------------------------------------- `WebSocket:Close` terminates the WebSocket connection. After closing, the `OnClose` event will fire and no more messages can be sent or received. [Example](https://docs.volt.bz/docs/websocket/close#example) ------------------------------------------------------------- local ws = WebSocket.connect("wss://example.com/socket") ws.OnClose:Connect(function() print("Connection closed") end) -- Use the connection ws:Send("Hello!") -- Close after 10 seconds task.wait(10) ws:Close() [Cleanup Pattern](https://docs.volt.bz/docs/websocket/close#cleanup-pattern) ----------------------------------------------------------------------------- local ws = WebSocket.connect("wss://example.com/socket") local function cleanup() if ws then ws:Close() ws = nil end end -- Close on script end or when done cleanup() [Notes](https://docs.volt.bz/docs/websocket/close#notes) --------------------------------------------------------- * Connection cannot be reopened after closing * `OnClose` event fires after calling Close * Safe to call multiple times [Related](https://docs.volt.bz/docs/websocket/close#related) ------------------------------------------------------------- * [`WebSocket.connect`](https://docs.volt.bz/docs/websocket/connect) - Create connection * [`OnClose`](https://docs.volt.bz/docs/websocket/onclose) - Close event [WebSocket\ \ Previous Page](https://docs.volt.bz/docs/websocket) [WebSocket.connect\ \ Next Page](https://docs.volt.bz/docs/websocket/connect) ### On this page [Syntax](https://docs.volt.bz/docs/websocket/close#syntax) [Parameters](https://docs.volt.bz/docs/websocket/close#parameters) [Returns](https://docs.volt.bz/docs/websocket/close#returns) [Description](https://docs.volt.bz/docs/websocket/close#description) [Example](https://docs.volt.bz/docs/websocket/close#example) [Cleanup Pattern](https://docs.volt.bz/docs/websocket/close#cleanup-pattern) [Notes](https://docs.volt.bz/docs/websocket/close#notes) [Related](https://docs.volt.bz/docs/websocket/close#related) --- # Volt Documentation [VoltSignal](https://docs.volt.bz/docs/voltsignal) VoltSignal:Connect ================== Connects a handler function to the signal. [Syntax](https://docs.volt.bz/docs/voltsignal/connect#syntax) -------------------------------------------------------------- VoltSignal:Connect(f: function) -> VoltConnection [Parameters](https://docs.volt.bz/docs/voltsignal/connect#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `f` | `function` | The handler function to call when the signal fires | [Returns](https://docs.volt.bz/docs/voltsignal/connect#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `VoltConnection` | A connection object that can be used to disconnect | [Description](https://docs.volt.bz/docs/voltsignal/connect#description) ------------------------------------------------------------------------ `VoltSignal:Connect` registers a function to be called whenever the signal is fired. The function will receive any arguments passed to `Fire`. Returns a `VoltConnection` that can be used to disconnect the handler. [Example](https://docs.volt.bz/docs/voltsignal/connect#example) ---------------------------------------------------------------- local signal = VoltSignal.new() -- Connect a handler local connection = signal:Connect(function(message) print("Received:", message) end) -- Fire the signal signal:Fire("Hello, World!") -- Output: Received: Hello, World! -- Disconnect when done connection:Disconnect() [Multiple Connections](https://docs.volt.bz/docs/voltsignal/connect#multiple-connections) ------------------------------------------------------------------------------------------ local signal = VoltSignal.new() signal:Connect(function(value) print("Handler 1:", value) end) signal:Connect(function(value) print("Handler 2:", value * 2) end) signal:Fire(10) -- Output: -- Handler 1: 10 -- Handler 2: 20 [Related Functions](https://docs.volt.bz/docs/voltsignal/connect#related-functions) ------------------------------------------------------------------------------------ * [`VoltSignal.new`](https://docs.volt.bz/docs/voltsignal/new) - Create a signal * [`VoltConnection:Disconnect`](https://docs.volt.bz/docs/voltsignal/disconnect) - Disconnect a handler [VoltSignal\ \ Previous Page](https://docs.volt.bz/docs/voltsignal) [VoltConnection:Disconnect\ \ Next Page](https://docs.volt.bz/docs/voltsignal/disconnect) ### On this page [Syntax](https://docs.volt.bz/docs/voltsignal/connect#syntax) [Parameters](https://docs.volt.bz/docs/voltsignal/connect#parameters) [Returns](https://docs.volt.bz/docs/voltsignal/connect#returns) [Description](https://docs.volt.bz/docs/voltsignal/connect#description) [Example](https://docs.volt.bz/docs/voltsignal/connect#example) [Multiple Connections](https://docs.volt.bz/docs/voltsignal/connect#multiple-connections) [Related Functions](https://docs.volt.bz/docs/voltsignal/connect#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) getnamecallmethod ================= Gets the method name being called in a `__namecall` hook. [Syntax](https://docs.volt.bz/docs/metatable/getnamecallmethod#syntax) ----------------------------------------------------------------------- getnamecallmethod() -> string [Returns](https://docs.volt.bz/docs/metatable/getnamecallmethod#returns) ------------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The method name being called | [Description](https://docs.volt.bz/docs/metatable/getnamecallmethod#description) --------------------------------------------------------------------------------- `getnamecallmethod` returns the name of the method being called when inside a `__namecall` metamethod hook. This is essential for filtering which method calls to intercept. [Example](https://docs.volt.bz/docs/metatable/getnamecallmethod#example) ------------------------------------------------------------------------- local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local method = getnamecallmethod() if method == "Kick" then return -- Block kick end if method == "FireServer" then print("FireServer called on:", self) end return oldNamecall(self, ...) end)) [Common Methods to Hook](https://docs.volt.bz/docs/metatable/getnamecallmethod#common-methods-to-hook) ------------------------------------------------------------------------------------------------------- | Method | Object | Description | | --- | --- | --- | | `FireServer` | RemoteEvent | Client to server communication | | `InvokeServer` | RemoteFunction | Client to server with return | | `Kick` | Player | Kick the player | | `Destroy` | Instance | Destroy an instance | | `GetService` | ServiceProvider | Get a service | [Filtering Example](https://docs.volt.bz/docs/metatable/getnamecallmethod#filtering-example) --------------------------------------------------------------------------------------------- local blockedMethods = {"Kick", "Ban", "Disconnect"} oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local method = getnamecallmethod() if table.find(blockedMethods, method) then warn("Blocked:", method) return end return oldNamecall(self, ...) end)) [Notes](https://docs.volt.bz/docs/metatable/getnamecallmethod#notes) --------------------------------------------------------------------- * Only works inside `__namecall` hooks * Returns the exact method name as a string * Case-sensitive [Metatable\ \ Previous Page](https://docs.volt.bz/docs/metatable) [getrawmetatable\ \ Next Page](https://docs.volt.bz/docs/metatable/getrawmetatable) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/getnamecallmethod#syntax) [Returns](https://docs.volt.bz/docs/metatable/getnamecallmethod#returns) [Description](https://docs.volt.bz/docs/metatable/getnamecallmethod#description) [Example](https://docs.volt.bz/docs/metatable/getnamecallmethod#example) [Common Methods to Hook](https://docs.volt.bz/docs/metatable/getnamecallmethod#common-methods-to-hook) [Filtering Example](https://docs.volt.bz/docs/metatable/getnamecallmethod#filtering-example) [Notes](https://docs.volt.bz/docs/metatable/getnamecallmethod#notes) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy:Execute ===================== Schedules code execution on this Lua state. [Syntax](https://docs.volt.bz/docs/luastateproxy/execute#syntax) ----------------------------------------------------------------- state:Execute(source: string, ...: any) -> () [Parameters](https://docs.volt.bz/docs/luastateproxy/execute#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `source` | `string` | The Lua code to execute | | `...` | `any` | Arguments passed to the script | [Returns](https://docs.volt.bz/docs/luastateproxy/execute#returns) ------------------------------------------------------------------- This method does not return a value. [Description](https://docs.volt.bz/docs/luastateproxy/execute#description) --------------------------------------------------------------------------- `LuaStateProxy:Execute` schedules code execution on the Lua state. The code string will be executed in the context of that state, and any additional arguments will be passed to the script via varargs (`...`). [Example](https://docs.volt.bz/docs/luastateproxy/execute#example) ------------------------------------------------------------------- local state = getluastate() state:Execute([[\ print("Executed on state:", ...)\ ]], "arg1", "arg2") [Execute on Actor State](https://docs.volt.bz/docs/luastateproxy/execute#execute-on-actor-state) ------------------------------------------------------------------------------------------------- local actor = Instance.new("Actor") actor.Parent = workspace local actorState = getluastate(actor) actorState:Execute([[\ print("Running on actor state!")\ print("Arguments:", ...)\ ]], "test", 123) [Pass Data to State](https://docs.volt.bz/docs/luastateproxy/execute#pass-data-to-state) ----------------------------------------------------------------------------------------- local gameState = getgamestate() local data = { message = "Hello", value = 42 } gameState:Execute([[\ local data = ...\ print("Message:", data.message)\ print("Value:", data.value)\ ]], data) [Setup Code on New States](https://docs.volt.bz/docs/luastateproxy/execute#setup-code-on-new-states) ----------------------------------------------------------------------------------------------------- on_actor_state_created.Event:Connect(function(actor) local state = getluastate(actor) state:Execute([[\ -- Setup code runs before any scripts\ print("State initialized!")\ _G.setupComplete = true\ ]]) end) [Notes](https://docs.volt.bz/docs/luastateproxy/execute#notes) --------------------------------------------------------------- * Code executes asynchronously on the target state * Arguments are passed via varargs (`...`) * Useful for injecting code or setting up state before scripts run [Related Methods](https://docs.volt.bz/docs/luastateproxy/execute#related-methods) ----------------------------------------------------------------------------------- * [`LuaStateProxy:GetActors`](https://docs.volt.bz/docs/luastateproxy/getactors) - Get actors for this state * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get state for an actor [LuaStateProxy.Event\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/event) [LuaStateProxy:GetActors\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/getactors) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/execute#syntax) [Parameters](https://docs.volt.bz/docs/luastateproxy/execute#parameters) [Returns](https://docs.volt.bz/docs/luastateproxy/execute#returns) [Description](https://docs.volt.bz/docs/luastateproxy/execute#description) [Example](https://docs.volt.bz/docs/luastateproxy/execute#example) [Execute on Actor State](https://docs.volt.bz/docs/luastateproxy/execute#execute-on-actor-state) [Pass Data to State](https://docs.volt.bz/docs/luastateproxy/execute#pass-data-to-state) [Setup Code on New States](https://docs.volt.bz/docs/luastateproxy/execute#setup-code-on-new-states) [Notes](https://docs.volt.bz/docs/luastateproxy/execute#notes) [Related Methods](https://docs.volt.bz/docs/luastateproxy/execute#related-methods) --- # Volt Documentation [oth](https://docs.volt.bz/docs/oth) oth.is\_hook\_thread ==================== Returns true if the current thread is a hook thread. [Syntax](https://docs.volt.bz/docs/oth/is_hook_thread#syntax) -------------------------------------------------------------- oth.is_hook_thread() -> boolean [Returns](https://docs.volt.bz/docs/oth/is_hook_thread#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if running in a hook thread, false otherwise | [Description](https://docs.volt.bz/docs/oth/is_hook_thread#description) ------------------------------------------------------------------------ `oth.is_hook_thread` checks whether the current code is executing within a hook thread created by `oth.hook`. This allows you to detect hook context and behave differently. [Example](https://docs.volt.bz/docs/oth/is_hook_thread#example) ---------------------------------------------------------------- local originalPrint = oth.hook(print, function(...) if oth.is_hook_thread() then print("[HOOK THREAD]", ...) else print("[MAIN THREAD]", ...) end return originalPrint(...) end) print("Test") -- Output: [HOOK THREAD] Test [Conditional Behavior](https://docs.volt.bz/docs/oth/is_hook_thread#conditional-behavior) ------------------------------------------------------------------------------------------ local originalFunc = oth.hook(someCFunction, function(...) if oth.is_hook_thread() then -- Running in hook thread print("Hook context detected") -- Do hook-specific logic end return originalFunc(...) end) [Notes](https://docs.volt.bz/docs/oth/is_hook_thread#notes) ------------------------------------------------------------ * Returns `true` only when executing within a hook created by `oth.hook` * Returns `false` on the main thread or in other contexts * Useful for implementing hook-specific behavior [Related Functions](https://docs.volt.bz/docs/oth/is_hook_thread#related-functions) ------------------------------------------------------------------------------------ * [`oth.hook`](https://docs.volt.bz/docs/oth/hook) - Create a hook * [`get_original_thread`](https://docs.volt.bz/docs/oth/get_original_thread) - Get the original thread [oth.hook\ \ Previous Page](https://docs.volt.bz/docs/oth/hook) [oth.unhook\ \ Next Page](https://docs.volt.bz/docs/oth/unhook) ### On this page [Syntax](https://docs.volt.bz/docs/oth/is_hook_thread#syntax) [Returns](https://docs.volt.bz/docs/oth/is_hook_thread#returns) [Description](https://docs.volt.bz/docs/oth/is_hook_thread#description) [Example](https://docs.volt.bz/docs/oth/is_hook_thread#example) [Conditional Behavior](https://docs.volt.bz/docs/oth/is_hook_thread#conditional-behavior) [Notes](https://docs.volt.bz/docs/oth/is_hook_thread#notes) [Related Functions](https://docs.volt.bz/docs/oth/is_hook_thread#related-functions) --- # Volt Documentation [oth](https://docs.volt.bz/docs/oth) oth.hook ======== Secure alternative to `hookfunction` for C functions. Hooks are executed on separate threads. [Syntax](https://docs.volt.bz/docs/oth/hook#syntax) ---------------------------------------------------- oth.hook(target: function, hook: function) -> function [Parameters](https://docs.volt.bz/docs/oth/hook#parameters) ------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `target` | `function` | The C function to hook | | `hook` | `function` | The replacement function | [Returns](https://docs.volt.bz/docs/oth/hook#returns) ------------------------------------------------------ | Type | Description | | --- | --- | | `function` | A reference to the original function | [Description](https://docs.volt.bz/docs/oth/hook#description) -------------------------------------------------------------- `oth.hook` replaces the target C function with your hook function. Unlike `hookfunction`, hooks are executed on separate threads, providing better isolation and safety. The function returns a reference to the original, allowing you to call it from within your hook. [Example](https://docs.volt.bz/docs/oth/hook#example) ------------------------------------------------------ -- Hook a C function local originalFunc = oth.hook(someCFunction, function(...) print("Hooked call:", ...) return originalFunc(...) end) -- Call the original originalFunc("test") [Thread Safety](https://docs.volt.bz/docs/oth/hook#thread-safety) ------------------------------------------------------------------ local originalPrint = oth.hook(print, function(...) -- This runs on a separate thread if oth.is_hook_thread() then print("[HOOK THREAD]", ...) end return originalPrint(...) end) [Notes](https://docs.volt.bz/docs/oth/hook#notes) -------------------------------------------------- * Only works with C functions (not Luau closures) * Hooks execute on separate threads for better isolation * Use `oth.is_hook_thread()` to detect hook context * The returned original can be called to bypass the hook * Remove hooks with `oth.unhook` [Related Functions](https://docs.volt.bz/docs/oth/hook#related-functions) -------------------------------------------------------------------------- * [`oth.unhook`](https://docs.volt.bz/docs/oth/unhook) - Remove a hook * [`oth.get_root_callback`](https://docs.volt.bz/docs/oth/get_root_callback) - Get original function * [`oth.is_hook_thread`](https://docs.volt.bz/docs/oth/is_hook_thread) - Check hook thread context [oth.get\_root\_callback\ \ Previous Page](https://docs.volt.bz/docs/oth/get_root_callback) [oth.is\_hook\_thread\ \ Next Page](https://docs.volt.bz/docs/oth/is_hook_thread) ### On this page [Syntax](https://docs.volt.bz/docs/oth/hook#syntax) [Parameters](https://docs.volt.bz/docs/oth/hook#parameters) [Returns](https://docs.volt.bz/docs/oth/hook#returns) [Description](https://docs.volt.bz/docs/oth/hook#description) [Example](https://docs.volt.bz/docs/oth/hook#example) [Thread Safety](https://docs.volt.bz/docs/oth/hook#thread-safety) [Notes](https://docs.volt.bz/docs/oth/hook#notes) [Related Functions](https://docs.volt.bz/docs/oth/hook#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mousemoverel ============ Moves the mouse cursor relative to its current position. [Syntax](https://docs.volt.bz/docs/input/mousemoverel#syntax) -------------------------------------------------------------- mousemoverel(dx: number, dy: number) -> void [Parameters](https://docs.volt.bz/docs/input/mousemoverel#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `dx` | `number` | Horizontal offset in pixels | | `dy` | `number` | Vertical offset in pixels | [Returns](https://docs.volt.bz/docs/input/mousemoverel#returns) ---------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mousemoverel#description) ------------------------------------------------------------------------ `mousemoverel` moves the mouse cursor by the specified amount relative to its current position. [Example](https://docs.volt.bz/docs/input/mousemoverel#example) ---------------------------------------------------------------- -- Move right 100 pixels mousemoverel(100, 0) -- Move down 50 pixels mousemoverel(0, 50) -- Move diagonally mousemoverel(50, 50) [Circle Motion](https://docs.volt.bz/docs/input/mousemoverel#circle-motion) ---------------------------------------------------------------------------- -- Draw a circle with mouse movement for i = 0, 360, 5 do local rad = math.rad(i) local dx = math.cos(rad) * 2 local dy = math.sin(rad) * 2 mousemoverel(dx, dy) task.wait(0.01) end [Related Functions](https://docs.volt.bz/docs/input/mousemoverel#related-functions) ------------------------------------------------------------------------------------ * [`mousemoveabs`](https://docs.volt.bz/docs/input/mousemoveabs) - Move to absolute position [mousemoveabs\ \ Previous Page](https://docs.volt.bz/docs/input/mousemoveabs) [mousescroll\ \ Next Page](https://docs.volt.bz/docs/input/mousescroll) ### On this page [Syntax](https://docs.volt.bz/docs/input/mousemoverel#syntax) [Parameters](https://docs.volt.bz/docs/input/mousemoverel#parameters) [Returns](https://docs.volt.bz/docs/input/mousemoverel#returns) [Description](https://docs.volt.bz/docs/input/mousemoverel#description) [Example](https://docs.volt.bz/docs/input/mousemoverel#example) [Circle Motion](https://docs.volt.bz/docs/input/mousemoverel#circle-motion) [Related Functions](https://docs.volt.bz/docs/input/mousemoverel#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) writefile ========= Writes data to a file. [Syntax](https://docs.volt.bz/docs/filesystem/writefile#syntax) ---------------------------------------------------------------- writefile(path: string, data: string) -> void [Parameters](https://docs.volt.bz/docs/filesystem/writefile#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path | | `data` | `string` | The data to write | [Returns](https://docs.volt.bz/docs/filesystem/writefile#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/filesystem/writefile#description) -------------------------------------------------------------------------- `writefile` writes data to a file, creating the file if it doesn't exist or overwriting it if it does. Parent folders are created automatically. [Example](https://docs.volt.bz/docs/filesystem/writefile#example) ------------------------------------------------------------------ -- Write a simple text file writefile("hello.txt", "Hello, World!") -- Verify the content print(readfile("hello.txt")) -- "Hello, World!" [Writing JSON](https://docs.volt.bz/docs/filesystem/writefile#writing-json) ---------------------------------------------------------------------------- local HttpService = game:GetService("HttpService") local settings = { volume = 0.5, graphics = "high", keybinds = { toggle = "F1", menu = "F2" } } writefile("settings.json", HttpService:JSONEncode(settings)) [Writing to Subfolders](https://docs.volt.bz/docs/filesystem/writefile#writing-to-subfolders) ---------------------------------------------------------------------------------------------- -- Parent folders are created automatically writefile("data/saves/slot1.txt", "Save data here") -- Or create them explicitly makefolder("logs") writefile("logs/session.log", "Session started") [Binary Data](https://docs.volt.bz/docs/filesystem/writefile#binary-data) -------------------------------------------------------------------------- -- Write binary data (as string) local binary = string.char(0, 1, 2, 3, 255) writefile("binary.bin", binary) [Related Functions](https://docs.volt.bz/docs/filesystem/writefile#related-functions) -------------------------------------------------------------------------------------- * [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) - Read a file * [`appendfile`](https://docs.volt.bz/docs/filesystem/appendfile) - Append to a file * [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) - Check if file exists [readfile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/readfile) [Input\ \ Next Page](https://docs.volt.bz/docs/input) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/writefile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/writefile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/writefile#returns) [Description](https://docs.volt.bz/docs/filesystem/writefile#description) [Example](https://docs.volt.bz/docs/filesystem/writefile#example) [Writing JSON](https://docs.volt.bz/docs/filesystem/writefile#writing-json) [Writing to Subfolders](https://docs.volt.bz/docs/filesystem/writefile#writing-to-subfolders) [Binary Data](https://docs.volt.bz/docs/filesystem/writefile#binary-data) [Related Functions](https://docs.volt.bz/docs/filesystem/writefile#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.generatekey ================= Generates a random encryption key. [Syntax](https://docs.volt.bz/docs/crypt/generatekey#syntax) ------------------------------------------------------------- crypt.generatekey() -> string [Returns](https://docs.volt.bz/docs/crypt/generatekey#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | A Base64-encoded random key | [Description](https://docs.volt.bz/docs/crypt/generatekey#description) ----------------------------------------------------------------------- `crypt.generatekey` generates a cryptographically secure random key suitable for use with encryption functions. [Example](https://docs.volt.bz/docs/crypt/generatekey#example) --------------------------------------------------------------- -- Generate a key local key = crypt.generatekey() print("Generated key:", key) -- Use the key for encryption local data = "Secret message" local encrypted = crypt.encrypt(data, key) local decrypted = crypt.decrypt(encrypted, key) print("Original:", data) print("Decrypted:", decrypted) [Notes](https://docs.volt.bz/docs/crypt/generatekey#notes) ----------------------------------------------------------- * The key is suitable for AES encryption * Keys should be stored securely and not shared [Related Functions](https://docs.volt.bz/docs/crypt/generatekey#related-functions) ----------------------------------------------------------------------------------- * [`crypt.encrypt`](https://docs.volt.bz/docs/crypt/encrypt) - Encrypt data * [`crypt.decrypt`](https://docs.volt.bz/docs/crypt/decrypt) - Decrypt data * [`crypt.generatebytes`](https://docs.volt.bz/docs/crypt/generatebytes) - Generate raw bytes [crypt.generatebytes\ \ Previous Page](https://docs.volt.bz/docs/crypt/generatebytes) [crypt.hash\ \ Next Page](https://docs.volt.bz/docs/crypt/hash) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/generatekey#syntax) [Returns](https://docs.volt.bz/docs/crypt/generatekey#returns) [Description](https://docs.volt.bz/docs/crypt/generatekey#description) [Example](https://docs.volt.bz/docs/crypt/generatekey#example) [Notes](https://docs.volt.bz/docs/crypt/generatekey#notes) [Related Functions](https://docs.volt.bz/docs/crypt/generatekey#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) getgamestate ============ Returns the default game Lua state. [Syntax](https://docs.volt.bz/docs/actors/getgamestate#syntax) --------------------------------------------------------------- getgamestate() -> LuaStateProxy [Returns](https://docs.volt.bz/docs/actors/getgamestate#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `LuaStateProxy` | The LuaStateProxy for the main game state | [Description](https://docs.volt.bz/docs/actors/getgamestate#description) ------------------------------------------------------------------------- `getgamestate` returns the `LuaStateProxy` for the default game Lua state. This is the main execution environment where most game scripts run. [Example](https://docs.volt.bz/docs/actors/getgamestate#example) ----------------------------------------------------------------- local gameState = getgamestate() print("Game state ID:", gameState.Id) print("Is Actor State:", gameState.IsActorState) -- false [Execute Code on Game State](https://docs.volt.bz/docs/actors/getgamestate#execute-code-on-game-state) ------------------------------------------------------------------------------------------------------- local gameState = getgamestate() gameState:Execute([[\ print("Executed on game state!")\ ]]) [Compare States](https://docs.volt.bz/docs/actors/getgamestate#compare-states) ------------------------------------------------------------------------------- local gameState = getgamestate() local currentState = getluastate() if gameState.Id == currentState.Id then print("Running on game state") else print("Running on different state") end [Related Functions](https://docs.volt.bz/docs/actors/getgamestate#related-functions) ------------------------------------------------------------------------------------- * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get LuaStateProxy for a specific actor or script * [`getactorstates`](https://docs.volt.bz/docs/actors/getactorstates) - Get all active LuaStateProxy objects * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all Actor instances [getactorstates\ \ Previous Page](https://docs.volt.bz/docs/actors/getactorstates) [getluastate\ \ Next Page](https://docs.volt.bz/docs/actors/getluastate) ### On this page [Syntax](https://docs.volt.bz/docs/actors/getgamestate#syntax) [Returns](https://docs.volt.bz/docs/actors/getgamestate#returns) [Description](https://docs.volt.bz/docs/actors/getgamestate#description) [Example](https://docs.volt.bz/docs/actors/getgamestate#example) [Execute Code on Game State](https://docs.volt.bz/docs/actors/getgamestate#execute-code-on-game-state) [Compare States](https://docs.volt.bz/docs/actors/getgamestate#compare-states) [Related Functions](https://docs.volt.bz/docs/actors/getgamestate#related-functions) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) getgenv ======= Returns the volt's global environment table. [Syntax](https://docs.volt.bz/docs/environment/getgenv#syntax) --------------------------------------------------------------- getgenv() -> table [Returns](https://docs.volt.bz/docs/environment/getgenv#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | The volt's global environment | [Description](https://docs.volt.bz/docs/environment/getgenv#description) ------------------------------------------------------------------------- `getgenv` returns the global environment table used by volt. Variables stored here persist across different script executions and can be accessed by all scripts running in volt. [Example](https://docs.volt.bz/docs/environment/getgenv#example) ----------------------------------------------------------------- -- Store a value in the volt environment getgenv().myGlobalValue = "Hello from script 1" -- Later, in another script execution print(getgenv().myGlobalValue) -- "Hello from script 1" [Shared State](https://docs.volt.bz/docs/environment/getgenv#shared-state) --------------------------------------------------------------------------- -- Script 1: Initialize shared state getgenv().SharedData = { players = {}, settings = { enabled = true } } -- Script 2: Access shared state if getgenv().SharedData then print("Settings:", getgenv().SharedData.settings.enabled) end [Checking if Script Already Ran](https://docs.volt.bz/docs/environment/getgenv#checking-if-script-already-ran) --------------------------------------------------------------------------------------------------------------- if getgenv().MyScriptLoaded then warn("Script already running!") return end getgenv().MyScriptLoaded = true -- Rest of your script... [Related Functions](https://docs.volt.bz/docs/environment/getgenv#related-functions) ------------------------------------------------------------------------------------- * [`getrenv`](https://docs.volt.bz/docs/environment/getrenv) - Get game's environment * [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) - Get a script's environment [getgc\ \ Previous Page](https://docs.volt.bz/docs/environment/getgc) [getreg\ \ Next Page](https://docs.volt.bz/docs/environment/getreg) ### On this page [Syntax](https://docs.volt.bz/docs/environment/getgenv#syntax) [Returns](https://docs.volt.bz/docs/environment/getgenv#returns) [Description](https://docs.volt.bz/docs/environment/getgenv#description) [Example](https://docs.volt.bz/docs/environment/getgenv#example) [Shared State](https://docs.volt.bz/docs/environment/getgenv#shared-state) [Checking if Script Already Ran](https://docs.volt.bz/docs/environment/getgenv#checking-if-script-already-ran) [Related Functions](https://docs.volt.bz/docs/environment/getgenv#related-functions) --- # Volt Documentation [WebSocket](https://docs.volt.bz/docs/websocket) WebSocket.connect ================= Creates a new WebSocket connection to the specified URL. [Syntax](https://docs.volt.bz/docs/websocket/connect#syntax) ------------------------------------------------------------- WebSocket.connect(url: string) -> WebSocket [Parameters](https://docs.volt.bz/docs/websocket/connect#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `url` | `string` | The WebSocket URL to connect to | [Returns](https://docs.volt.bz/docs/websocket/connect#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `WebSocket` | A WebSocket object with methods and events | [Description](https://docs.volt.bz/docs/websocket/connect#description) ----------------------------------------------------------------------- `WebSocket.connect` establishes a persistent connection to a WebSocket server. The URL must use the `ws://` or `wss://` protocol (wss for secure/encrypted connections). [Example](https://docs.volt.bz/docs/websocket/connect#example) --------------------------------------------------------------- -- Connect to a WebSocket server local ws = WebSocket.connect("wss://echo.websocket.org") -- Handle incoming messages ws.OnMessage:Connect(function(message) print("Received:", message) end) -- Handle connection close ws.OnClose:Connect(function() print("Connection closed") end) -- Send a message ws:Send("Hello, WebSocket!") [Echo Server Example](https://docs.volt.bz/docs/websocket/connect#echo-server-example) --------------------------------------------------------------------------------------- local ws = WebSocket.connect("wss://echo.websocket.org") ws.OnMessage:Connect(function(msg) print("Echo:", msg) end) -- Send messages that will be echoed back ws:Send("Test message 1") ws:Send("Test message 2") [Notes](https://docs.volt.bz/docs/websocket/connect#notes) ----------------------------------------------------------- * WebSocket URLs must use `ws://` or `wss://` protocol * `wss://` is WebSocket Secure (encrypted) * Connection is maintained until closed or server disconnects [Related](https://docs.volt.bz/docs/websocket/connect#related) --------------------------------------------------------------- * [`WebSocket:Send`](https://docs.volt.bz/docs/websocket/send) - Send messages * [`WebSocket:Close`](https://docs.volt.bz/docs/websocket/close) - Close connection * [`OnMessage`](https://docs.volt.bz/docs/websocket/onmessage) - Receive messages [WebSocket:Close\ \ Previous Page](https://docs.volt.bz/docs/websocket/close) [WebSocket.OnClose\ \ Next Page](https://docs.volt.bz/docs/websocket/onclose) ### On this page [Syntax](https://docs.volt.bz/docs/websocket/connect#syntax) [Parameters](https://docs.volt.bz/docs/websocket/connect#parameters) [Returns](https://docs.volt.bz/docs/websocket/connect#returns) [Description](https://docs.volt.bz/docs/websocket/connect#description) [Example](https://docs.volt.bz/docs/websocket/connect#example) [Echo Server Example](https://docs.volt.bz/docs/websocket/connect#echo-server-example) [Notes](https://docs.volt.bz/docs/websocket/connect#notes) [Related](https://docs.volt.bz/docs/websocket/connect#related) --- # Volt Documentation [VoltSignal](https://docs.volt.bz/docs/voltsignal) VoltConnection:Disconnect ========================= Disconnects the connection from the signal. [Syntax](https://docs.volt.bz/docs/voltsignal/disconnect#syntax) ----------------------------------------------------------------- VoltConnection:Disconnect() -> () [Parameters](https://docs.volt.bz/docs/voltsignal/disconnect#parameters) ------------------------------------------------------------------------- This method takes no parameters. [Returns](https://docs.volt.bz/docs/voltsignal/disconnect#returns) ------------------------------------------------------------------- This method does not return a value. [Description](https://docs.volt.bz/docs/voltsignal/disconnect#description) --------------------------------------------------------------------------- `VoltConnection:Disconnect` removes the handler from the signal. After disconnecting, the handler will no longer be called when the signal fires. [Example](https://docs.volt.bz/docs/voltsignal/disconnect#example) ------------------------------------------------------------------- local signal = VoltSignal.new() local connection = signal:Connect(function() print("This will only print once") end) signal:Fire() -- Output: This will only print once -- Disconnect the handler connection:Disconnect() signal:Fire() -- No output - handler is disconnected [One-Time Connection Pattern](https://docs.volt.bz/docs/voltsignal/disconnect#one-time-connection-pattern) ----------------------------------------------------------------------------------------------------------- local signal = VoltSignal.new() local connection connection = signal:Connect(function(value) print("Received:", value) connection:Disconnect() -- Disconnect after first fire end) signal:Fire("First") -- Output: Received: First signal:Fire("Second") -- No output [Cleanup Pattern](https://docs.volt.bz/docs/voltsignal/disconnect#cleanup-pattern) ----------------------------------------------------------------------------------- local signal = VoltSignal.new() local connections = {} -- Store connections for cleanup table.insert(connections, signal:Connect(function() print("Handler 1") end)) table.insert(connections, signal:Connect(function() print("Handler 2") end)) -- Cleanup all connections for _, conn in ipairs(connections) do conn:Disconnect() end [Related Functions](https://docs.volt.bz/docs/voltsignal/disconnect#related-functions) --------------------------------------------------------------------------------------- * [`VoltSignal:Connect`](https://docs.volt.bz/docs/voltsignal/connect) - Create a connection [VoltSignal:Connect\ \ Previous Page](https://docs.volt.bz/docs/voltsignal/connect) [VoltSignal:Fire\ \ Next Page](https://docs.volt.bz/docs/voltsignal/fire) ### On this page [Syntax](https://docs.volt.bz/docs/voltsignal/disconnect#syntax) [Parameters](https://docs.volt.bz/docs/voltsignal/disconnect#parameters) [Returns](https://docs.volt.bz/docs/voltsignal/disconnect#returns) [Description](https://docs.volt.bz/docs/voltsignal/disconnect#description) [Example](https://docs.volt.bz/docs/voltsignal/disconnect#example) [One-Time Connection Pattern](https://docs.volt.bz/docs/voltsignal/disconnect#one-time-connection-pattern) [Cleanup Pattern](https://docs.volt.bz/docs/voltsignal/disconnect#cleanup-pattern) [Related Functions](https://docs.volt.bz/docs/voltsignal/disconnect#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) cansignalreplicate ================== Checks if a signal can be replicated to the server. [Syntax](https://docs.volt.bz/docs/signals/cansignalreplicate#syntax) ---------------------------------------------------------------------- cansignalreplicate(signal: RBXScriptSignal) -> boolean [Parameters](https://docs.volt.bz/docs/signals/cansignalreplicate#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal to check | [Returns](https://docs.volt.bz/docs/signals/cansignalreplicate#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | True if the signal can replicate | [Description](https://docs.volt.bz/docs/signals/cansignalreplicate#description) -------------------------------------------------------------------------------- `cansignalreplicate` checks whether a given signal can be fired with server replication using `replicatesignal`. [Example](https://docs.volt.bz/docs/signals/cansignalreplicate#example) ------------------------------------------------------------------------ local prompt = workspace.Door.ProximityPrompt if cansignalreplicate(prompt.Triggered) then print("This signal can be replicated!") replicatesignal(prompt.Triggered, game.Players.LocalPlayer) else print("This signal cannot be replicated") end [Related Functions](https://docs.volt.bz/docs/signals/cansignalreplicate#related-functions) -------------------------------------------------------------------------------------------- * [`replicatesignal`](https://docs.volt.bz/docs/signals/replicatesignal) - Fire with replication * [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) - Fire locally [Signals\ \ Previous Page](https://docs.volt.bz/docs/signals) [firesignal\ \ Next Page](https://docs.volt.bz/docs/signals/firesignal) ### On this page [Syntax](https://docs.volt.bz/docs/signals/cansignalreplicate#syntax) [Parameters](https://docs.volt.bz/docs/signals/cansignalreplicate#parameters) [Returns](https://docs.volt.bz/docs/signals/cansignalreplicate#returns) [Description](https://docs.volt.bz/docs/signals/cansignalreplicate#description) [Example](https://docs.volt.bz/docs/signals/cansignalreplicate#example) [Related Functions](https://docs.volt.bz/docs/signals/cansignalreplicate#related-functions) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy:GetActors ======================= Returns all Actor instances associated with this Lua state. [Syntax](https://docs.volt.bz/docs/luastateproxy/getactors#syntax) ------------------------------------------------------------------- state:GetActors() -> {Actor} [Parameters](https://docs.volt.bz/docs/luastateproxy/getactors#parameters) --------------------------------------------------------------------------- This method takes no parameters. [Returns](https://docs.volt.bz/docs/luastateproxy/getactors#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `{Actor}` | Array of Actor instances for this state | [Description](https://docs.volt.bz/docs/luastateproxy/getactors#description) ----------------------------------------------------------------------------- `LuaStateProxy:GetActors` returns all Actor instances that are associated with this Lua state. For actor states, this will return the actors using that state. For the game state, this will return an empty array. [Example](https://docs.volt.bz/docs/luastateproxy/getactors#example) --------------------------------------------------------------------- local state = getluastate() local actors = state:GetActors() print("Actors in state:", #actors) for i, actor in ipairs(actors) do print(i, actor:GetFullName()) end [Actor State Example](https://docs.volt.bz/docs/luastateproxy/getactors#actor-state-example) --------------------------------------------------------------------------------------------- local actor = Instance.new("Actor") actor.Parent = workspace local actorState = getluastate(actor) local actors = actorState:GetActors() -- Should contain the actor we just created for _, a in ipairs(actors) do print("Actor:", a:GetFullName()) end [Filter by State](https://docs.volt.bz/docs/luastateproxy/getactors#filter-by-state) ------------------------------------------------------------------------------------- local allStates = getactorstates() for _, state in ipairs(allStates) do if state.IsActorState then local actors = state:GetActors() print("State", state.Id, "has", #actors, "actors") end end [Related Methods](https://docs.volt.bz/docs/luastateproxy/getactors#related-methods) ------------------------------------------------------------------------------------- * [`LuaStateProxy:Execute`](https://docs.volt.bz/docs/luastateproxy/execute) - Execute code on the state * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get state for an actor [LuaStateProxy:Execute\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/execute) [LuaStateProxy.Id\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/id) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/getactors#syntax) [Parameters](https://docs.volt.bz/docs/luastateproxy/getactors#parameters) [Returns](https://docs.volt.bz/docs/luastateproxy/getactors#returns) [Description](https://docs.volt.bz/docs/luastateproxy/getactors#description) [Example](https://docs.volt.bz/docs/luastateproxy/getactors#example) [Actor State Example](https://docs.volt.bz/docs/luastateproxy/getactors#actor-state-example) [Filter by State](https://docs.volt.bz/docs/luastateproxy/getactors#filter-by-state) [Related Methods](https://docs.volt.bz/docs/luastateproxy/getactors#related-methods) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) getreg ====== Returns the Lua registry table. [Syntax](https://docs.volt.bz/docs/environment/getreg#syntax) -------------------------------------------------------------- getreg() -> table [Returns](https://docs.volt.bz/docs/environment/getreg#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | The Lua registry | [Description](https://docs.volt.bz/docs/environment/getreg#description) ------------------------------------------------------------------------ `getreg` returns the Lua registry, a special table used internally by Lua to store references. This can contain connections, threads, and other internal objects. [Example](https://docs.volt.bz/docs/environment/getreg#example) ---------------------------------------------------------------- local registry = getreg() for i, v in pairs(registry) do print(i, type(v), v) end [Finding Connections](https://docs.volt.bz/docs/environment/getreg#finding-connections) ---------------------------------------------------------------------------------------- -- Find all RBXScriptConnections in the registry local connections = {} for _, v in pairs(getreg()) do if type(v) == "table" then for _, item in pairs(v) do local t = typeof(item) if t == "RBXScriptConnection" then table.insert(connections, item) end end end end print("Found", #connections, "connections") [Notes](https://docs.volt.bz/docs/environment/getreg#notes) ------------------------------------------------------------ * The registry contains internal Lua objects * Modifying the registry can cause undefined behavior * Use with caution and primarily for reading [Related Functions](https://docs.volt.bz/docs/environment/getreg#related-functions) ------------------------------------------------------------------------------------ * [`getgenv`](https://docs.volt.bz/docs/environment/getgenv) - Get volt's environment * [`getrenv`](https://docs.volt.bz/docs/environment/getrenv) - Get game environment [getgenv\ \ Previous Page](https://docs.volt.bz/docs/environment/getgenv) [getrenv\ \ Next Page](https://docs.volt.bz/docs/environment/getrenv) ### On this page [Syntax](https://docs.volt.bz/docs/environment/getreg#syntax) [Returns](https://docs.volt.bz/docs/environment/getreg#returns) [Description](https://docs.volt.bz/docs/environment/getreg#description) [Example](https://docs.volt.bz/docs/environment/getreg#example) [Finding Connections](https://docs.volt.bz/docs/environment/getreg#finding-connections) [Notes](https://docs.volt.bz/docs/environment/getreg#notes) [Related Functions](https://docs.volt.bz/docs/environment/getreg#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.setupvalue ================ Sets an upvalue in a function by index. [Syntax](https://docs.volt.bz/docs/debug/setupvalue#syntax) ------------------------------------------------------------ debug.setupvalue(func: function | number, index: number, value: any) -> void [Parameters](https://docs.volt.bz/docs/debug/setupvalue#parameters) -------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | | `index` | `number` | The upvalue index (1-based) | | `value` | `any` | The new value for the upvalue | [Returns](https://docs.volt.bz/docs/debug/setupvalue#returns) -------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/debug/setupvalue#description) ---------------------------------------------------------------------- `debug.setupvalue` modifies an upvalue (captured variable) in a function. Changes affect the shared variable, so all functions that capture the same upvalue will see the change. [Example](https://docs.volt.bz/docs/debug/setupvalue#example) -------------------------------------------------------------- local count = 0 local function getCount() return count end local function increment() count = count + 1 end print(getCount()) -- 0 -- Directly modify the upvalue debug.setupvalue(getCount, 1, 100) print(getCount()) -- 100 increment() print(getCount()) -- 101 [Shared Upvalues](https://docs.volt.bz/docs/debug/setupvalue#shared-upvalues) ------------------------------------------------------------------------------ When multiple functions share an upvalue, modifying it affects all of them: local shared = "original" local function read() return shared end local function write(val) shared = val end -- Both functions share the same upvalue debug.setupvalue(read, 1, "modified") print(read()) -- "modified" print(write) -- The write function also sees the change [Related Functions](https://docs.volt.bz/docs/debug/setupvalue#related-functions) ---------------------------------------------------------------------------------- * [`debug.getupvalue`](https://docs.volt.bz/docs/debug/getupvalue) - Get an upvalue * [`debug.getupvalues`](https://docs.volt.bz/docs/debug/getupvalues) - Get all upvalues [debug.setstack\ \ Previous Page](https://docs.volt.bz/docs/debug/setstack) [debug.validlevel\ \ Next Page](https://docs.volt.bz/docs/debug/validlevel) ### On this page [Syntax](https://docs.volt.bz/docs/debug/setupvalue#syntax) [Parameters](https://docs.volt.bz/docs/debug/setupvalue#parameters) [Returns](https://docs.volt.bz/docs/debug/setupvalue#returns) [Description](https://docs.volt.bz/docs/debug/setupvalue#description) [Example](https://docs.volt.bz/docs/debug/setupvalue#example) [Shared Upvalues](https://docs.volt.bz/docs/debug/setupvalue#shared-upvalues) [Related Functions](https://docs.volt.bz/docs/debug/setupvalue#related-functions) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getsenv ======= Gets a script's environment table. [Syntax](https://docs.volt.bz/docs/scripts/getsenv#syntax) ----------------------------------------------------------- getsenv(script: LocalScript | ModuleScript) -> table [Parameters](https://docs.volt.bz/docs/scripts/getsenv#parameters) ------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `script` | `LocalScript` or `ModuleScript` | The script | [Returns](https://docs.volt.bz/docs/scripts/getsenv#returns) ------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | The script's environment | [Description](https://docs.volt.bz/docs/scripts/getsenv#description) --------------------------------------------------------------------- `getsenv` returns the environment table (`_ENV`) of a script, giving access to all its local and global variables. [Example](https://docs.volt.bz/docs/scripts/getsenv#example) ------------------------------------------------------------- local scripts = getrunningscripts() if #scripts > 0 then local env = getsenv(scripts[1]) print("Variables in script:") for key, value in pairs(env) do print("-", key, "=", type(value)) end end [Accessing Script Variables](https://docs.volt.bz/docs/scripts/getsenv#accessing-script-variables) --------------------------------------------------------------------------------------------------- local function getScriptVariable(scriptName, varName) for _, script in ipairs(getrunningscripts()) do if script.Name == scriptName then local env = getsenv(script) return env[varName] end end return nil end local playerData = getScriptVariable("MainScript", "PlayerData") if playerData then print("Found player data!") end [Modifying Script Variables](https://docs.volt.bz/docs/scripts/getsenv#modifying-script-variables) --------------------------------------------------------------------------------------------------- local env = getsenv(targetScript) if env then -- Modify a variable env.SomeFlag = true -- Call a function from the script if env.SomeFunction then env.SomeFunction() end end [Related Functions](https://docs.volt.bz/docs/scripts/getsenv#related-functions) --------------------------------------------------------------------------------- * [`getgenv`](https://docs.volt.bz/docs/environment/getgenv) - Get volt's environment * [`getrenv`](https://docs.volt.bz/docs/environment/getrenv) - Get game environment [getscripts\ \ Previous Page](https://docs.volt.bz/docs/scripts/getscripts) [loadstring\ \ Next Page](https://docs.volt.bz/docs/scripts/loadstring) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getsenv#syntax) [Parameters](https://docs.volt.bz/docs/scripts/getsenv#parameters) [Returns](https://docs.volt.bz/docs/scripts/getsenv#returns) [Description](https://docs.volt.bz/docs/scripts/getsenv#description) [Example](https://docs.volt.bz/docs/scripts/getsenv#example) [Accessing Script Variables](https://docs.volt.bz/docs/scripts/getsenv#accessing-script-variables) [Modifying Script Variables](https://docs.volt.bz/docs/scripts/getsenv#modifying-script-variables) [Related Functions](https://docs.volt.bz/docs/scripts/getsenv#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mousescroll =========== Simulates mouse wheel scrolling. [Syntax](https://docs.volt.bz/docs/input/mousescroll#syntax) ------------------------------------------------------------- mousescroll(delta: number) -> void [Parameters](https://docs.volt.bz/docs/input/mousescroll#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `delta` | `number` | Scroll amount (positive = up, negative = down) | [Returns](https://docs.volt.bz/docs/input/mousescroll#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mousescroll#description) ----------------------------------------------------------------------- `mousescroll` simulates scrolling the mouse wheel. Positive values scroll up, negative values scroll down. [Example](https://docs.volt.bz/docs/input/mousescroll#example) --------------------------------------------------------------- -- Scroll up mousescroll(3) -- Scroll down mousescroll(-3) -- Smooth scroll for i = 1, 10 do mousescroll(1) task.wait(0.05) end [Related Functions](https://docs.volt.bz/docs/input/mousescroll#related-functions) ----------------------------------------------------------------------------------- * [`mousemoverel`](https://docs.volt.bz/docs/input/mousemoverel) - Move mouse relative * [`mousemoveabs`](https://docs.volt.bz/docs/input/mousemoveabs) - Move mouse absolute [mousemoverel\ \ Previous Page](https://docs.volt.bz/docs/input/mousemoverel) [Instances\ \ Next Page](https://docs.volt.bz/docs/instances) ### On this page [Syntax](https://docs.volt.bz/docs/input/mousescroll#syntax) [Parameters](https://docs.volt.bz/docs/input/mousescroll#parameters) [Returns](https://docs.volt.bz/docs/input/mousescroll#returns) [Description](https://docs.volt.bz/docs/input/mousescroll#description) [Example](https://docs.volt.bz/docs/input/mousescroll#example) [Related Functions](https://docs.volt.bz/docs/input/mousescroll#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) setclipboard ============ Copies text to the system clipboard. [Syntax](https://docs.volt.bz/docs/miscellaneous/setclipboard#syntax) ---------------------------------------------------------------------- setclipboard(text: string) -> void [Aliases](https://docs.volt.bz/docs/miscellaneous/setclipboard#aliases) ------------------------------------------------------------------------ * `toclipboard` * `setrbxclipboard` [Parameters](https://docs.volt.bz/docs/miscellaneous/setclipboard#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The text to copy | [Returns](https://docs.volt.bz/docs/miscellaneous/setclipboard#returns) ------------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/setclipboard#description) -------------------------------------------------------------------------------- `setclipboard` copies the provided text to the system clipboard, allowing it to be pasted elsewhere. [Example](https://docs.volt.bz/docs/miscellaneous/setclipboard#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](https://docs.volt.bz/docs/miscellaneous/setclipboard#notes) -------------------------------------------------------------------- * Works with any string data * Useful for copying large amounts of data [Related Functions](https://docs.volt.bz/docs/miscellaneous/setclipboard#related-functions) -------------------------------------------------------------------------------------------- * [`identifyexecutor`](https://docs.volt.bz/docs/miscellaneous/identifyexecutor) - Get executor info [saveplace\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/saveplace) [setfflag\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/setfflag) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/setclipboard#syntax) [Aliases](https://docs.volt.bz/docs/miscellaneous/setclipboard#aliases) [Parameters](https://docs.volt.bz/docs/miscellaneous/setclipboard#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/setclipboard#returns) [Description](https://docs.volt.bz/docs/miscellaneous/setclipboard#description) [Example](https://docs.volt.bz/docs/miscellaneous/setclipboard#example) [Notes](https://docs.volt.bz/docs/miscellaneous/setclipboard#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/setclipboard#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) appendfile ========== Appends data to the end of a file. [Syntax](https://docs.volt.bz/docs/filesystem/appendfile#syntax) ----------------------------------------------------------------- appendfile(path: string, data: string) -> void [Parameters](https://docs.volt.bz/docs/filesystem/appendfile#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path | | `data` | `string` | The data to append | [Returns](https://docs.volt.bz/docs/filesystem/appendfile#returns) ------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/filesystem/appendfile#description) --------------------------------------------------------------------------- `appendfile` adds data to the end of an existing file without overwriting its contents. If the file doesn't exist, it will be created. [Example](https://docs.volt.bz/docs/filesystem/appendfile#example) ------------------------------------------------------------------- -- Create initial file writefile("log.txt", "Log started\n") -- Append entries appendfile("log.txt", "Entry 1: Hello\n") appendfile("log.txt", "Entry 2: World\n") -- Read the result print(readfile("log.txt")) --[[\ Log started\ Entry 1: Hello\ Entry 2: World\ ]] [Logging Example](https://docs.volt.bz/docs/filesystem/appendfile#logging-example) ----------------------------------------------------------------------------------- local function log(message) local timestamp = os.date("%Y-%m-%d %H:%M:%S") appendfile("debug.log", "[" .. timestamp .. "] " .. message .. "\n") end log("Script started") log("Player joined") log("Event triggered") [Related Functions](https://docs.volt.bz/docs/filesystem/appendfile#related-functions) --------------------------------------------------------------------------------------- * [`writefile`](https://docs.volt.bz/docs/filesystem/writefile) - Overwrite a file * [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) - Read a file [Filesystem\ \ Previous Page](https://docs.volt.bz/docs/filesystem) [delfile\ \ Next Page](https://docs.volt.bz/docs/filesystem/delfile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/appendfile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/appendfile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/appendfile#returns) [Description](https://docs.volt.bz/docs/filesystem/appendfile#description) [Example](https://docs.volt.bz/docs/filesystem/appendfile#example) [Logging Example](https://docs.volt.bz/docs/filesystem/appendfile#logging-example) [Related Functions](https://docs.volt.bz/docs/filesystem/appendfile#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) getluastate =========== Returns the LuaStateProxy for a given Actor or loaded script. [Syntax](https://docs.volt.bz/docs/actors/getluastate#syntax) -------------------------------------------------------------- getluastate(actor_or_script: (Actor | BaseScript)?) -> LuaStateProxy [Parameters](https://docs.volt.bz/docs/actors/getluastate#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `actor_or_script` | `Actor \| BaseScript?` | The Actor or script to get the state for. If omitted, returns current state | [Returns](https://docs.volt.bz/docs/actors/getluastate#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `LuaStateProxy` | The LuaStateProxy for the given Actor or script, or current state | [Description](https://docs.volt.bz/docs/actors/getluastate#description) ------------------------------------------------------------------------ `getluastate` returns the `LuaStateProxy` object for a specific Actor or loaded script. If no argument is provided, it returns the `LuaStateProxy` for the current Lua state. [Example](https://docs.volt.bz/docs/actors/getluastate#example) ---------------------------------------------------------------- -- Get current state local currentState = getluastate() print("Current state ID:", currentState.Id) -- Get state for an actor local actor = Instance.new("Actor") actor.Parent = workspace local actorState = getluastate(actor) print("Actor state ID:", actorState.Id, "Is Actor:", actorState.IsActorState) [Get State for Script](https://docs.volt.bz/docs/actors/getluastate#get-state-for-script) ------------------------------------------------------------------------------------------ -- Get state for a specific script local script = workspace.SomeScript local scriptState = getluastate(script) print("Script state ID:", scriptState.Id) [Access State Properties](https://docs.volt.bz/docs/actors/getluastate#access-state-properties) ------------------------------------------------------------------------------------------------ local state = getluastate() print("State ID:", state.Id) print("Is Actor State:", state.IsActorState) -- Get all actors for this state local actors = state:GetActors() print("Actors in state:", #actors) [Related Functions](https://docs.volt.bz/docs/actors/getluastate#related-functions) ------------------------------------------------------------------------------------ * [`getactorstates`](https://docs.volt.bz/docs/actors/getactorstates) - Get all active LuaStateProxy objects * [`getgamestate`](https://docs.volt.bz/docs/actors/getgamestate) - Get the default game Lua state * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all Actor instances [getgamestate\ \ Previous Page](https://docs.volt.bz/docs/actors/getgamestate) [isparallel\ \ Next Page](https://docs.volt.bz/docs/actors/isparallel) ### On this page [Syntax](https://docs.volt.bz/docs/actors/getluastate#syntax) [Parameters](https://docs.volt.bz/docs/actors/getluastate#parameters) [Returns](https://docs.volt.bz/docs/actors/getluastate#returns) [Description](https://docs.volt.bz/docs/actors/getluastate#description) [Example](https://docs.volt.bz/docs/actors/getluastate#example) [Get State for Script](https://docs.volt.bz/docs/actors/getluastate#get-state-for-script) [Access State Properties](https://docs.volt.bz/docs/actors/getluastate#access-state-properties) [Related Functions](https://docs.volt.bz/docs/actors/getluastate#related-functions) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy.Id ================ Unique identifier for this Lua state. [Syntax](https://docs.volt.bz/docs/luastateproxy/id#syntax) ------------------------------------------------------------ state.Id: number [Description](https://docs.volt.bz/docs/luastateproxy/id#description) ---------------------------------------------------------------------- `LuaStateProxy.Id` is a read-only property that returns a unique numeric identifier for the Lua state. Each state (game state and actor states) has its own unique ID. [Example](https://docs.volt.bz/docs/luastateproxy/id#example) -------------------------------------------------------------- local state = getluastate() print("State ID:", state.Id) [Compare States](https://docs.volt.bz/docs/luastateproxy/id#compare-states) ---------------------------------------------------------------------------- local gameState = getgamestate() local currentState = getluastate() if gameState.Id == currentState.Id then print("Running on game state") else print("Running on different state (ID:", currentState.Id, ")") end [Track States](https://docs.volt.bz/docs/luastateproxy/id#track-states) ------------------------------------------------------------------------ local states = getactorstates() local stateIds = {} for _, state in ipairs(states) do table.insert(stateIds, state.Id) print("State ID:", state.Id, "Is Actor:", state.IsActorState) end [Related Properties](https://docs.volt.bz/docs/luastateproxy/id#related-properties) ------------------------------------------------------------------------------------ * [`LuaStateProxy.IsActorState`](https://docs.volt.bz/docs/luastateproxy/isactorstate) - Check if state is for actors * [`LuaStateProxy.Event`](https://docs.volt.bz/docs/luastateproxy/event) - Communication event [LuaStateProxy:GetActors\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/getactors) [LuaStateProxy.IsActorState\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/isactorstate) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/id#syntax) [Description](https://docs.volt.bz/docs/luastateproxy/id#description) [Example](https://docs.volt.bz/docs/luastateproxy/id#example) [Compare States](https://docs.volt.bz/docs/luastateproxy/id#compare-states) [Track States](https://docs.volt.bz/docs/luastateproxy/id#track-states) [Related Properties](https://docs.volt.bz/docs/luastateproxy/id#related-properties) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) setfflag ======== Sets a Roblox Fast Flag value. [Syntax](https://docs.volt.bz/docs/miscellaneous/setfflag#syntax) ------------------------------------------------------------------ setfflag(name: string, value: string) -> void [Parameters](https://docs.volt.bz/docs/miscellaneous/setfflag#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `name` | `string` | The flag name | | `value` | `string` | The value to set | [Returns](https://docs.volt.bz/docs/miscellaneous/setfflag#returns) -------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/setfflag#description) ---------------------------------------------------------------------------- `setfflag` sets the value of a Roblox Fast Flag (FFlag). These flags control various engine features and behaviors. [Example](https://docs.volt.bz/docs/miscellaneous/setfflag#example) -------------------------------------------------------------------- -- Enable a flag setfflag("DFIntTaskSchedulerTargetFps", "240") -- Disable graphics features setfflag("FFlagDebugDisableTelemetryEphemeralCounter", "true") [Notes](https://docs.volt.bz/docs/miscellaneous/setfflag#notes) ---------------------------------------------------------------- * Flag names are case-sensitive * Values are always strings * Some flags require restart to take effect * Not all flags can be modified [Related Functions](https://docs.volt.bz/docs/miscellaneous/setfflag#related-functions) ---------------------------------------------------------------------------------------- * [`getfflag`](https://docs.volt.bz/docs/miscellaneous/getfflag) - Get flag value [setclipboard\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/setclipboard) [setfpscap\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/setfpscap) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/setfflag#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/setfflag#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/setfflag#returns) [Description](https://docs.volt.bz/docs/miscellaneous/setfflag#description) [Example](https://docs.volt.bz/docs/miscellaneous/setfflag#example) [Notes](https://docs.volt.bz/docs/miscellaneous/setfflag#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/setfflag#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) cloneref ======== Creates a new reference to an instance that compares as different. [Syntax](https://docs.volt.bz/docs/instances/cloneref#syntax) -------------------------------------------------------------- cloneref(instance: Instance) -> Instance [Parameters](https://docs.volt.bz/docs/instances/cloneref#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to clone a reference to | [Returns](https://docs.volt.bz/docs/instances/cloneref#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `Instance` | A new reference to the same instance | [Description](https://docs.volt.bz/docs/instances/cloneref#description) ------------------------------------------------------------------------ `cloneref` creates a new reference to an instance. The cloned reference points to the same underlying object, but the two references are not equal when compared with `==`. [Example](https://docs.volt.bz/docs/instances/cloneref#example) ---------------------------------------------------------------- local part = workspace.Part local clone = cloneref(part) -- Both reference the same instance print(part.Name) -- "Part" print(clone.Name) -- "Part" -- But they compare as different print(part == clone) -- false -- Changes through one affect the other clone.Name = "Renamed" print(part.Name) -- "Renamed" [Use Cases](https://docs.volt.bz/docs/instances/cloneref#use-cases) -------------------------------------------------------------------- * **Anti-detection**: Prevent games from detecting your references * **Reference hiding**: Create references that can't be found through equality checks [Verification](https://docs.volt.bz/docs/instances/cloneref#verification) -------------------------------------------------------------------------- -- Verify they're the same underlying instance print(compareinstances(part, clone)) -- true [Related Functions](https://docs.volt.bz/docs/instances/cloneref#related-functions) ------------------------------------------------------------------------------------ * [`compareinstances`](https://docs.volt.bz/docs/instances/compareinstances) - Compare two references [Instances\ \ Previous Page](https://docs.volt.bz/docs/instances) [compareinstances\ \ Next Page](https://docs.volt.bz/docs/instances/compareinstances) ### On this page [Syntax](https://docs.volt.bz/docs/instances/cloneref#syntax) [Parameters](https://docs.volt.bz/docs/instances/cloneref#parameters) [Returns](https://docs.volt.bz/docs/instances/cloneref#returns) [Description](https://docs.volt.bz/docs/instances/cloneref#description) [Example](https://docs.volt.bz/docs/instances/cloneref#example) [Use Cases](https://docs.volt.bz/docs/instances/cloneref#use-cases) [Verification](https://docs.volt.bz/docs/instances/cloneref#verification) [Related Functions](https://docs.volt.bz/docs/instances/cloneref#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.hash ========== Generates a hash of the provided data. [Syntax](https://docs.volt.bz/docs/crypt/hash#syntax) ------------------------------------------------------ crypt.hash(data: string, algorithm: string?) -> string [Parameters](https://docs.volt.bz/docs/crypt/hash#parameters) -------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The data to hash | | `algorithm` | `string` | (Optional) Hash algorithm, default "SHA256" | [Returns](https://docs.volt.bz/docs/crypt/hash#returns) -------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The hexadecimal hash string | [Description](https://docs.volt.bz/docs/crypt/hash#description) ---------------------------------------------------------------- `crypt.hash` generates a cryptographic hash of the input data using the specified algorithm. [Supported Algorithms](https://docs.volt.bz/docs/crypt/hash#supported-algorithms) ---------------------------------------------------------------------------------- * `MD5` * `SHA1` * `SHA256` (default) * `SHA384` * `SHA512` [Example](https://docs.volt.bz/docs/crypt/hash#example) -------------------------------------------------------- local data = "Hello, World!" -- Default SHA256 local hash = crypt.hash(data) print("SHA256:", hash) -- Other algorithms print("MD5:", crypt.hash(data, "MD5")) print("SHA1:", crypt.hash(data, "SHA1")) print("SHA512:", crypt.hash(data, "SHA512")) [Use Cases](https://docs.volt.bz/docs/crypt/hash#use-cases) ------------------------------------------------------------ * Verifying data integrity * Creating unique identifiers * Password hashing (prefer `crypt.hmac` for security) [Related Functions](https://docs.volt.bz/docs/crypt/hash#related-functions) ---------------------------------------------------------------------------- * [`crypt.hmac`](https://docs.volt.bz/docs/crypt/hmac) - HMAC authentication [crypt.generatekey\ \ Previous Page](https://docs.volt.bz/docs/crypt/generatekey) [crypt.hmac\ \ Next Page](https://docs.volt.bz/docs/crypt/hmac) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/hash#syntax) [Parameters](https://docs.volt.bz/docs/crypt/hash#parameters) [Returns](https://docs.volt.bz/docs/crypt/hash#returns) [Description](https://docs.volt.bz/docs/crypt/hash#description) [Supported Algorithms](https://docs.volt.bz/docs/crypt/hash#supported-algorithms) [Example](https://docs.volt.bz/docs/crypt/hash#example) [Use Cases](https://docs.volt.bz/docs/crypt/hash#use-cases) [Related Functions](https://docs.volt.bz/docs/crypt/hash#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleerr =========== Prints an error message to the console. [Syntax](https://docs.volt.bz/docs/console/rconsoleerr#syntax) --------------------------------------------------------------- rconsoleerr(text: string) -> void [Parameters](https://docs.volt.bz/docs/console/rconsoleerr#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The error message | [Returns](https://docs.volt.bz/docs/console/rconsoleerr#returns) ----------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoleerr#description) ------------------------------------------------------------------------- `rconsoleerr` prints an error-level message to the console, typically displayed in red or with an error prefix. [Example](https://docs.volt.bz/docs/console/rconsoleerr#example) ----------------------------------------------------------------- rconsoleshow() rconsoleerr("Failed to load module!") rconsoleerr("Connection timed out") [Related Functions](https://docs.volt.bz/docs/console/rconsoleerr#related-functions) ------------------------------------------------------------------------------------- * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print plain text * [`rconsoleinfo`](https://docs.volt.bz/docs/console/rconsoleinfo) - Print info * [`rconsolewarn`](https://docs.volt.bz/docs/console/rconsolewarn) - Print warning [rconsoleclear\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleclear) [rconsolehidden\ \ Next Page](https://docs.volt.bz/docs/console/rconsolehidden) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleerr#syntax) [Parameters](https://docs.volt.bz/docs/console/rconsoleerr#parameters) [Returns](https://docs.volt.bz/docs/console/rconsoleerr#returns) [Description](https://docs.volt.bz/docs/console/rconsoleerr#description) [Example](https://docs.volt.bz/docs/console/rconsoleerr#example) [Related Functions](https://docs.volt.bz/docs/console/rconsoleerr#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) getrawmetatable =============== Gets the raw metatable of an object, bypassing `__metatable`. [Syntax](https://docs.volt.bz/docs/metatable/getrawmetatable#syntax) --------------------------------------------------------------------- getrawmetatable(object: any) -> table? [Parameters](https://docs.volt.bz/docs/metatable/getrawmetatable#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `object` | `any` | The object to get the metatable from | [Returns](https://docs.volt.bz/docs/metatable/getrawmetatable#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `table?` | The raw metatable, or nil if none | [Description](https://docs.volt.bz/docs/metatable/getrawmetatable#description) ------------------------------------------------------------------------------- `getrawmetatable` retrieves the actual metatable of an object, bypassing the `__metatable` field that would normally prevent access via `getmetatable`. [Example](https://docs.volt.bz/docs/metatable/getrawmetatable#example) ----------------------------------------------------------------------- -- Normal getmetatable is blocked on Roblox objects print(getmetatable(game)) -- "The metatable is locked" -- getrawmetatable bypasses this local mt = getrawmetatable(game) print(mt) -- table: 0x... print(mt.__index) -- function print(mt.__namecall) -- function [Inspecting Metamethods](https://docs.volt.bz/docs/metatable/getrawmetatable#inspecting-metamethods) ----------------------------------------------------------------------------------------------------- local mt = getrawmetatable(game) for key, value in pairs(mt) do print(key, type(value)) end --[[\ __index function\ __newindex function\ __namecall function\ __tostring function\ ...\ ]] [Before Hooking](https://docs.volt.bz/docs/metatable/getrawmetatable#before-hooking) ------------------------------------------------------------------------------------- -- Always get the metatable before modifying local mt = getrawmetatable(game) local oldIndex = mt.__index -- You may need to unlock it first setreadonly(mt, false) mt.__index = newcclosure(function(self, key) print("Indexing:", key) return oldIndex(self, key) end) setreadonly(mt, true) [Related Functions](https://docs.volt.bz/docs/metatable/getrawmetatable#related-functions) ------------------------------------------------------------------------------------------- * [`setrawmetatable`](https://docs.volt.bz/docs/metatable/setrawmetatable) - Set a raw metatable * [`setreadonly`](https://docs.volt.bz/docs/metatable/setreadonly) - Unlock the metatable [getnamecallmethod\ \ Previous Page](https://docs.volt.bz/docs/metatable/getnamecallmethod) [isreadonly\ \ Next Page](https://docs.volt.bz/docs/metatable/isreadonly) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/getrawmetatable#syntax) [Parameters](https://docs.volt.bz/docs/metatable/getrawmetatable#parameters) [Returns](https://docs.volt.bz/docs/metatable/getrawmetatable#returns) [Description](https://docs.volt.bz/docs/metatable/getrawmetatable#description) [Example](https://docs.volt.bz/docs/metatable/getrawmetatable#example) [Inspecting Metamethods](https://docs.volt.bz/docs/metatable/getrawmetatable#inspecting-metamethods) [Before Hooking](https://docs.volt.bz/docs/metatable/getrawmetatable#before-hooking) [Related Functions](https://docs.volt.bz/docs/metatable/getrawmetatable#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) firesignal ========== Fires a signal with the given arguments. [Syntax](https://docs.volt.bz/docs/signals/firesignal#syntax) -------------------------------------------------------------- firesignal(signal: RBXScriptSignal, ...: any) -> void [Parameters](https://docs.volt.bz/docs/signals/firesignal#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal to fire | | `...` | `any` | Arguments to pass to handlers | [Returns](https://docs.volt.bz/docs/signals/firesignal#returns) ---------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/signals/firesignal#description) ------------------------------------------------------------------------ `firesignal` triggers all connected handlers of a signal with the provided arguments. This simulates the signal being fired naturally. [Example](https://docs.volt.bz/docs/signals/firesignal#example) ---------------------------------------------------------------- -- Fire a button's MouseButton1Click local button = PlayerGui.ScreenGui.TextButton firesignal(button.MouseButton1Click) -- Fire with arguments firesignal(someObject.CustomEvent, "arg1", 123, true) [Firing Input Events](https://docs.volt.bz/docs/signals/firesignal#firing-input-events) ---------------------------------------------------------------------------------------- -- Simulate a key press local UserInputService = game:GetService("UserInputService") local inputObject = Instance.new("InputObject") -- Pseudocode firesignal(UserInputService.InputBegan, inputObject, false) [Firing Touch Events](https://docs.volt.bz/docs/signals/firesignal#firing-touch-events) ---------------------------------------------------------------------------------------- local part = workspace.TouchPart local character = game.Players.LocalPlayer.Character local hrp = character.HumanoidRootPart -- Fire the Touched event firesignal(part.Touched, hrp) [Notes](https://docs.volt.bz/docs/signals/firesignal#notes) ------------------------------------------------------------ * All connected handlers will be called * Arguments are passed to each handler * Use `getconnections` to fire specific connections only [Related Functions](https://docs.volt.bz/docs/signals/firesignal#related-functions) ------------------------------------------------------------------------------------ * [`getconnections`](https://docs.volt.bz/docs/signals/getconnections) - Get signal connections * [`replicatesignal`](https://docs.volt.bz/docs/signals/replicatesignal) - Fire with replication [cansignalreplicate\ \ Previous Page](https://docs.volt.bz/docs/signals/cansignalreplicate) [getconnections\ \ Next Page](https://docs.volt.bz/docs/signals/getconnections) ### On this page [Syntax](https://docs.volt.bz/docs/signals/firesignal#syntax) [Parameters](https://docs.volt.bz/docs/signals/firesignal#parameters) [Returns](https://docs.volt.bz/docs/signals/firesignal#returns) [Description](https://docs.volt.bz/docs/signals/firesignal#description) [Example](https://docs.volt.bz/docs/signals/firesignal#example) [Firing Input Events](https://docs.volt.bz/docs/signals/firesignal#firing-input-events) [Firing Touch Events](https://docs.volt.bz/docs/signals/firesignal#firing-touch-events) [Notes](https://docs.volt.bz/docs/signals/firesignal#notes) [Related Functions](https://docs.volt.bz/docs/signals/firesignal#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) gethiddenproperties =================== Gets all hidden properties of an instance. [Syntax](https://docs.volt.bz/docs/reflection/gethiddenproperties#syntax) -------------------------------------------------------------------------- gethiddenproperties(instance: Instance) -> table [Parameters](https://docs.volt.bz/docs/reflection/gethiddenproperties#parameters) ---------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to check | [Returns](https://docs.volt.bz/docs/reflection/gethiddenproperties#returns) ---------------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Dictionary of hidden property values | [Description](https://docs.volt.bz/docs/reflection/gethiddenproperties#description) ------------------------------------------------------------------------------------ `gethiddenproperties` returns a table containing all hidden (non-scriptable) properties and their current values. [Example](https://docs.volt.bz/docs/reflection/gethiddenproperties#example) ---------------------------------------------------------------------------- local part = workspace.Part local hidden = gethiddenproperties(part) for property, value in pairs(hidden) do print(property, "=", value) end [Related Functions](https://docs.volt.bz/docs/reflection/gethiddenproperties#related-functions) ------------------------------------------------------------------------------------------------ * [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) - Get single hidden property * [`sethiddenproperty`](https://docs.volt.bz/docs/reflection/sethiddenproperty) - Set hidden property * [`getproperties`](https://docs.volt.bz/docs/reflection/getproperties) - Get all properties [Reflection\ \ Previous Page](https://docs.volt.bz/docs/reflection) [gethiddenproperty\ \ Next Page](https://docs.volt.bz/docs/reflection/gethiddenproperty) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/gethiddenproperties#syntax) [Parameters](https://docs.volt.bz/docs/reflection/gethiddenproperties#parameters) [Returns](https://docs.volt.bz/docs/reflection/gethiddenproperties#returns) [Description](https://docs.volt.bz/docs/reflection/gethiddenproperties#description) [Example](https://docs.volt.bz/docs/reflection/gethiddenproperties#example) [Related Functions](https://docs.volt.bz/docs/reflection/gethiddenproperties#related-functions) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) getrenv ======= Returns the game's global environment table. [Syntax](https://docs.volt.bz/docs/environment/getrenv#syntax) --------------------------------------------------------------- getrenv() -> table [Returns](https://docs.volt.bz/docs/environment/getrenv#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | The game's global environment | [Description](https://docs.volt.bz/docs/environment/getrenv#description) ------------------------------------------------------------------------- `getrenv` returns the global environment used by game scripts. This contains all standard Roblox globals like `game`, `workspace`, `Instance`, etc. [Example](https://docs.volt.bz/docs/environment/getrenv#example) ----------------------------------------------------------------- local renv = getrenv() -- Access game globals print(renv.game) -- Same as game print(renv.workspace) -- Same as workspace print(renv.Instance) -- Same as Instance [Finding Game Globals](https://docs.volt.bz/docs/environment/getrenv#finding-game-globals) ------------------------------------------------------------------------------------------- -- List all globals in the game environment local renv = getrenv() for name, value in pairs(renv) do print(name, type(value)) end [Difference from getgenv](https://docs.volt.bz/docs/environment/getrenv#difference-from-getgenv) ------------------------------------------------------------------------------------------------- | `getrenv()` | `getgenv()` | | --- | --- | | Game's environment | Volt's environment | | Contains Roblox globals | Contains volt globals | | Read-only access recommended | Can freely modify | [Checking for Global Modifications](https://docs.volt.bz/docs/environment/getrenv#checking-for-global-modifications) --------------------------------------------------------------------------------------------------------------------- -- Check if game modified a global local renv = getrenv() if renv.print ~= print then warn("print function was modified!") end [Related Functions](https://docs.volt.bz/docs/environment/getrenv#related-functions) ------------------------------------------------------------------------------------- * [`getgenv`](https://docs.volt.bz/docs/environment/getgenv) - Get volt's environment * [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) - Get a script's environment [getreg\ \ Previous Page](https://docs.volt.bz/docs/environment/getreg) [gettenv\ \ Next Page](https://docs.volt.bz/docs/environment/gettenv) ### On this page [Syntax](https://docs.volt.bz/docs/environment/getrenv#syntax) [Returns](https://docs.volt.bz/docs/environment/getrenv#returns) [Description](https://docs.volt.bz/docs/environment/getrenv#description) [Example](https://docs.volt.bz/docs/environment/getrenv#example) [Finding Game Globals](https://docs.volt.bz/docs/environment/getrenv#finding-game-globals) [Difference from getgenv](https://docs.volt.bz/docs/environment/getrenv#difference-from-getgenv) [Checking for Global Modifications](https://docs.volt.bz/docs/environment/getrenv#checking-for-global-modifications) [Related Functions](https://docs.volt.bz/docs/environment/getrenv#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.hmac ========== Generates an HMAC (Hash-based Message Authentication Code). [Syntax](https://docs.volt.bz/docs/crypt/hmac#syntax) ------------------------------------------------------ crypt.hmac(data: string, key: string, algorithm: string?) -> string [Parameters](https://docs.volt.bz/docs/crypt/hmac#parameters) -------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `data` | `string` | The data to authenticate | | `key` | `string` | The secret key | | `algorithm` | `string` | (Optional) Hash algorithm, default "SHA256" | [Returns](https://docs.volt.bz/docs/crypt/hmac#returns) -------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The HMAC as a hex string | [Description](https://docs.volt.bz/docs/crypt/hmac#description) ---------------------------------------------------------------- `crypt.hmac` generates a keyed-hash message authentication code, which provides both data integrity and authentication. [Supported Algorithms](https://docs.volt.bz/docs/crypt/hmac#supported-algorithms) ---------------------------------------------------------------------------------- * `MD5` * `SHA1` * `SHA256` (default) * `SHA384` * `SHA512` [Example](https://docs.volt.bz/docs/crypt/hmac#example) -------------------------------------------------------- local data = "Important message" local key = "secret_key" local mac = crypt.hmac(data, key, "SHA256") print("HMAC:", mac) [Verification Example](https://docs.volt.bz/docs/crypt/hmac#verification-example) ---------------------------------------------------------------------------------- local function verifyMessage(data, key, expectedHmac) local computed = crypt.hmac(data, key) return computed == expectedHmac end local key = "my_secret" local message = "Hello" local signature = crypt.hmac(message, key) -- Later, verify the message if verifyMessage(message, key, signature) then print("Message is authentic!") end [Related Functions](https://docs.volt.bz/docs/crypt/hmac#related-functions) ---------------------------------------------------------------------------- * [`crypt.hash`](https://docs.volt.bz/docs/crypt/hash) - Simple hashing [crypt.hash\ \ Previous Page](https://docs.volt.bz/docs/crypt/hash) [crypt.random\ \ Next Page](https://docs.volt.bz/docs/crypt/random) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/hmac#syntax) [Parameters](https://docs.volt.bz/docs/crypt/hmac#parameters) [Returns](https://docs.volt.bz/docs/crypt/hmac#returns) [Description](https://docs.volt.bz/docs/crypt/hmac#description) [Supported Algorithms](https://docs.volt.bz/docs/crypt/hmac#supported-algorithms) [Example](https://docs.volt.bz/docs/crypt/hmac#example) [Verification Example](https://docs.volt.bz/docs/crypt/hmac#verification-example) [Related Functions](https://docs.volt.bz/docs/crypt/hmac#related-functions) --- # Volt Documentation [WebSocket](https://docs.volt.bz/docs/websocket) WebSocket.OnClose ================= Signal that fires when the WebSocket connection is closed. [Syntax](https://docs.volt.bz/docs/websocket/onclose#syntax) ------------------------------------------------------------- WebSocket.OnClose:Connect(callback: () -> ()) -> Connection [Callback Parameters](https://docs.volt.bz/docs/websocket/onclose#callback-parameters) --------------------------------------------------------------------------------------- This callback receives no parameters. [Returns](https://docs.volt.bz/docs/websocket/onclose#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `Connection` | A connection that can be disconnected | [Description](https://docs.volt.bz/docs/websocket/onclose#description) ----------------------------------------------------------------------- `OnClose` is a signal that fires when the WebSocket connection is terminated, either by calling `Close()` or when the server disconnects. [Example](https://docs.volt.bz/docs/websocket/onclose#example) --------------------------------------------------------------- local ws = WebSocket.connect("wss://example.com/socket") ws.OnClose:Connect(function() print("Connection closed") end) -- Later... ws:Close() -- Output: Connection closed [Reconnection Pattern](https://docs.volt.bz/docs/websocket/onclose#reconnection-pattern) ----------------------------------------------------------------------------------------- local function createConnection() local ws = WebSocket.connect("wss://example.com/socket") ws.OnClose:Connect(function() print("Disconnected, reconnecting in 5 seconds...") task.wait(5) createConnection() end) ws.OnMessage:Connect(function(msg) print("Message:", msg) end) return ws end local connection = createConnection() [Cleanup on Close](https://docs.volt.bz/docs/websocket/onclose#cleanup-on-close) --------------------------------------------------------------------------------- local ws = WebSocket.connect("wss://example.com/socket") local isConnected = true ws.OnClose:Connect(function() isConnected = false print("Cleaning up...") -- Perform cleanup tasks end) -- Check connection state before sending if isConnected then ws:Send("Hello!") end [Related](https://docs.volt.bz/docs/websocket/onclose#related) --------------------------------------------------------------- * [`WebSocket.connect`](https://docs.volt.bz/docs/websocket/connect) - Create connection * [`WebSocket:Close`](https://docs.volt.bz/docs/websocket/close) - Close connection * [`OnMessage`](https://docs.volt.bz/docs/websocket/onmessage) - Message event [WebSocket.connect\ \ Previous Page](https://docs.volt.bz/docs/websocket/connect) [WebSocket.OnMessage\ \ Next Page](https://docs.volt.bz/docs/websocket/onmessage) ### On this page [Syntax](https://docs.volt.bz/docs/websocket/onclose#syntax) [Callback Parameters](https://docs.volt.bz/docs/websocket/onclose#callback-parameters) [Returns](https://docs.volt.bz/docs/websocket/onclose#returns) [Description](https://docs.volt.bz/docs/websocket/onclose#description) [Example](https://docs.volt.bz/docs/websocket/onclose#example) [Reconnection Pattern](https://docs.volt.bz/docs/websocket/onclose#reconnection-pattern) [Cleanup on Close](https://docs.volt.bz/docs/websocket/onclose#cleanup-on-close) [Related](https://docs.volt.bz/docs/websocket/onclose#related) --- # Volt Documentation [VoltSignal](https://docs.volt.bz/docs/voltsignal) VoltSignal:Fire =============== Fires the signal with the given arguments. [Syntax](https://docs.volt.bz/docs/voltsignal/fire#syntax) ----------------------------------------------------------- VoltSignal:Fire(...: any) -> () [Parameters](https://docs.volt.bz/docs/voltsignal/fire#parameters) ------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `...` | `any` | Arguments to pass to connected handlers | [Returns](https://docs.volt.bz/docs/voltsignal/fire#returns) ------------------------------------------------------------- This method does not return a value. [Description](https://docs.volt.bz/docs/voltsignal/fire#description) --------------------------------------------------------------------- `VoltSignal:Fire` triggers all connected handlers and resumes any threads waiting on the signal. All provided arguments are passed to each handler and returned by `Wait`. [Example](https://docs.volt.bz/docs/voltsignal/fire#example) ------------------------------------------------------------- local signal = VoltSignal.new() signal:Connect(function(a, b, c) print(a, b, c) end) -- Fire with multiple arguments signal:Fire("hello", 42, true) -- Output: hello 42 true [Firing Without Arguments](https://docs.volt.bz/docs/voltsignal/fire#firing-without-arguments) ----------------------------------------------------------------------------------------------- local onComplete = VoltSignal.new() onComplete:Connect(function() print("Task completed!") end) onComplete:Fire() -- Output: Task completed! [Firing With Tables](https://docs.volt.bz/docs/voltsignal/fire#firing-with-tables) ----------------------------------------------------------------------------------- local onDataReceived = VoltSignal.new() onDataReceived:Connect(function(data) print("Received:", data.name, data.value) end) onDataReceived:Fire({ name = "Score", value = 100 }) -- Output: Received: Score 100 [Related Functions](https://docs.volt.bz/docs/voltsignal/fire#related-functions) --------------------------------------------------------------------------------- * [`VoltSignal:Connect`](https://docs.volt.bz/docs/voltsignal/connect) - Connect handlers * [`VoltSignal:Wait`](https://docs.volt.bz/docs/voltsignal/wait) - Wait for fire [VoltConnection:Disconnect\ \ Previous Page](https://docs.volt.bz/docs/voltsignal/disconnect) [VoltSignal.new\ \ Next Page](https://docs.volt.bz/docs/voltsignal/new) ### On this page [Syntax](https://docs.volt.bz/docs/voltsignal/fire#syntax) [Parameters](https://docs.volt.bz/docs/voltsignal/fire#parameters) [Returns](https://docs.volt.bz/docs/voltsignal/fire#returns) [Description](https://docs.volt.bz/docs/voltsignal/fire#description) [Example](https://docs.volt.bz/docs/voltsignal/fire#example) [Firing Without Arguments](https://docs.volt.bz/docs/voltsignal/fire#firing-without-arguments) [Firing With Tables](https://docs.volt.bz/docs/voltsignal/fire#firing-with-tables) [Related Functions](https://docs.volt.bz/docs/voltsignal/fire#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) iswindowactive ============== Checks if the game window is currently focused. [Syntax](https://docs.volt.bz/docs/input/iswindowactive#syntax) ---------------------------------------------------------------- iswindowactive() -> boolean [Aliases](https://docs.volt.bz/docs/input/iswindowactive#aliases) ------------------------------------------------------------------ * `isrbxactive` * `isgameactive` [Returns](https://docs.volt.bz/docs/input/iswindowactive#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | True if game window is focused | [Description](https://docs.volt.bz/docs/input/iswindowactive#description) -------------------------------------------------------------------------- `iswindowactive` returns whether the Roblox game window is currently the active/focused window. This is useful for input simulation to ensure inputs only occur when the game is focused. [Example](https://docs.volt.bz/docs/input/iswindowactive#example) ------------------------------------------------------------------ -- Only simulate input when game is focused if iswindowactive() then keypress(0x20) -- Press space task.wait(0.1) keyrelease(0x20) end [Wait for Focus](https://docs.volt.bz/docs/input/iswindowactive#wait-for-focus) -------------------------------------------------------------------------------- -- Wait until game is focused before executing repeat task.wait() until iswindowactive() print("Game is now focused!") [Related Functions](https://docs.volt.bz/docs/input/iswindowactive#related-functions) -------------------------------------------------------------------------------------- * [`keypress`](https://docs.volt.bz/docs/input/keypress) - Simulate key press * [`mouse1click`](https://docs.volt.bz/docs/input/mouse1click) - Simulate mouse click [Input\ \ Previous Page](https://docs.volt.bz/docs/input) [keyclick\ \ Next Page](https://docs.volt.bz/docs/input/keyclick) ### On this page [Syntax](https://docs.volt.bz/docs/input/iswindowactive#syntax) [Aliases](https://docs.volt.bz/docs/input/iswindowactive#aliases) [Returns](https://docs.volt.bz/docs/input/iswindowactive#returns) [Description](https://docs.volt.bz/docs/input/iswindowactive#description) [Example](https://docs.volt.bz/docs/input/iswindowactive#example) [Wait for Focus](https://docs.volt.bz/docs/input/iswindowactive#wait-for-focus) [Related Functions](https://docs.volt.bz/docs/input/iswindowactive#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsolehidden ============== Checks if the console window is hidden. [Syntax](https://docs.volt.bz/docs/console/rconsolehidden#syntax) ------------------------------------------------------------------ rconsolehidden() -> boolean [Returns](https://docs.volt.bz/docs/console/rconsolehidden#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if console is hidden/closed | [Description](https://docs.volt.bz/docs/console/rconsolehidden#description) ---------------------------------------------------------------------------- `rconsolehidden` returns whether the console window is currently hidden or not visible. [Example](https://docs.volt.bz/docs/console/rconsolehidden#example) -------------------------------------------------------------------- rconsoleshow() if not rconsolehidden() then rconsoleprint("Console is visible!\n") end rconsolehide() if rconsolehidden() then print("Console is now hidden") end [Related Functions](https://docs.volt.bz/docs/console/rconsolehidden#related-functions) ---------------------------------------------------------------------------------------- * [`rconsoletoggle`](https://docs.volt.bz/docs/console/rconsoletoggle) - Toggle visibility * [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) - Show the console * [`rconsolehide`](https://docs.volt.bz/docs/console/rconsolehide) - Hide the console [rconsoleerr\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleerr) [rconsolehide\ \ Next Page](https://docs.volt.bz/docs/console/rconsolehide) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsolehidden#syntax) [Returns](https://docs.volt.bz/docs/console/rconsolehidden#returns) [Description](https://docs.volt.bz/docs/console/rconsolehidden#description) [Example](https://docs.volt.bz/docs/console/rconsolehidden#example) [Related Functions](https://docs.volt.bz/docs/console/rconsolehidden#related-functions) --- # Volt Documentation [VoltSignal](https://docs.volt.bz/docs/voltsignal) VoltSignal.new ============== Creates a new VoltSignal instance. [Syntax](https://docs.volt.bz/docs/voltsignal/new#syntax) ---------------------------------------------------------- VoltSignal.new() -> VoltSignal [Parameters](https://docs.volt.bz/docs/voltsignal/new#parameters) ------------------------------------------------------------------ This function takes no parameters. [Returns](https://docs.volt.bz/docs/voltsignal/new#returns) ------------------------------------------------------------ | Type | Description | | --- | --- | | `VoltSignal` | A new VoltSignal instance | [Description](https://docs.volt.bz/docs/voltsignal/new#description) -------------------------------------------------------------------- `VoltSignal.new` creates a new signal object that can be used to implement custom events. The returned signal can have handlers connected to it and can be fired with arguments. [Example](https://docs.volt.bz/docs/voltsignal/new#example) ------------------------------------------------------------ -- Create a new signal local onPlayerDamaged = VoltSignal.new() -- Connect a handler onPlayerDamaged:Connect(function(player, damage) print(player.Name .. " took " .. damage .. " damage!") end) -- Fire the signal onPlayerDamaged:Fire(game.Players.LocalPlayer, 50) [Related Functions](https://docs.volt.bz/docs/voltsignal/new#related-functions) -------------------------------------------------------------------------------- * [`VoltSignal:Connect`](https://docs.volt.bz/docs/voltsignal/connect) - Connect a handler * [`VoltSignal:Fire`](https://docs.volt.bz/docs/voltsignal/fire) - Fire the signal [VoltSignal:Fire\ \ Previous Page](https://docs.volt.bz/docs/voltsignal/fire) [VoltSignal:Wait\ \ Next Page](https://docs.volt.bz/docs/voltsignal/wait) ### On this page [Syntax](https://docs.volt.bz/docs/voltsignal/new#syntax) [Parameters](https://docs.volt.bz/docs/voltsignal/new#parameters) [Returns](https://docs.volt.bz/docs/voltsignal/new#returns) [Description](https://docs.volt.bz/docs/voltsignal/new#description) [Example](https://docs.volt.bz/docs/voltsignal/new#example) [Related Functions](https://docs.volt.bz/docs/voltsignal/new#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) setstackhidden ============== Sets whether a function is hidden from stack traces. [Syntax](https://docs.volt.bz/docs/closures/setstackhidden#syntax) ------------------------------------------------------------------- setstackhidden(func: function, hidden: boolean) -> void [Parameters](https://docs.volt.bz/docs/closures/setstackhidden#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to modify | | `hidden` | `boolean` | Whether to hide from stack | [Returns](https://docs.volt.bz/docs/closures/setstackhidden#returns) --------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/closures/setstackhidden#description) ----------------------------------------------------------------------------- `setstackhidden` controls whether a function appears in stack traces and debug info. Hidden functions are invisible to stack inspection. [Example](https://docs.volt.bz/docs/closures/setstackhidden#example) --------------------------------------------------------------------- local function secretFunc() print("This function is hidden!") end setstackhidden(secretFunc, true) -- Now secretFunc won't appear in debug.traceback() [Use Cases](https://docs.volt.bz/docs/closures/setstackhidden#use-cases) ------------------------------------------------------------------------- * Hiding hook implementations * Preventing detection via stack inspection * Clean stack traces [Related Functions](https://docs.volt.bz/docs/closures/setstackhidden#related-functions) ----------------------------------------------------------------------------------------- * [`debug.getinfo`](https://docs.volt.bz/docs/debug/getinfo) - Get function info * [`debug.getcallstack`](https://docs.volt.bz/docs/debug/getcallstack) - Get call stack [restorefunction\ \ Previous Page](https://docs.volt.bz/docs/closures/restorefunction) [Console\ \ Next Page](https://docs.volt.bz/docs/console) ### On this page [Syntax](https://docs.volt.bz/docs/closures/setstackhidden#syntax) [Parameters](https://docs.volt.bz/docs/closures/setstackhidden#parameters) [Returns](https://docs.volt.bz/docs/closures/setstackhidden#returns) [Description](https://docs.volt.bz/docs/closures/setstackhidden#description) [Example](https://docs.volt.bz/docs/closures/setstackhidden#example) [Use Cases](https://docs.volt.bz/docs/closures/setstackhidden#use-cases) [Related Functions](https://docs.volt.bz/docs/closures/setstackhidden#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) delfile ======= Deletes a file. [Syntax](https://docs.volt.bz/docs/filesystem/delfile#syntax) -------------------------------------------------------------- delfile(path: string) -> void [Parameters](https://docs.volt.bz/docs/filesystem/delfile#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path to delete | [Returns](https://docs.volt.bz/docs/filesystem/delfile#returns) ---------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/filesystem/delfile#description) ------------------------------------------------------------------------ `delfile` permanently deletes a file at the specified path. [Example](https://docs.volt.bz/docs/filesystem/delfile#example) ---------------------------------------------------------------- -- Create a file writefile("temp.txt", "Temporary data") -- Verify it exists print(isfile("temp.txt")) -- true -- Delete it delfile("temp.txt") -- Verify it's gone print(isfile("temp.txt")) -- false [Safe Delete](https://docs.volt.bz/docs/filesystem/delfile#safe-delete) ------------------------------------------------------------------------ local function safeDelete(path) if isfile(path) then delfile(path) return true end return false end if safeDelete("myfile.txt") then print("File deleted") else print("File didn't exist") end [Related Functions](https://docs.volt.bz/docs/filesystem/delfile#related-functions) ------------------------------------------------------------------------------------ * [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) - Check if file exists * [`delfolder`](https://docs.volt.bz/docs/filesystem/delfolder) - Delete a folder [appendfile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/appendfile) [delfolder\ \ Next Page](https://docs.volt.bz/docs/filesystem/delfolder) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/delfile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/delfile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/delfile#returns) [Description](https://docs.volt.bz/docs/filesystem/delfile#description) [Example](https://docs.volt.bz/docs/filesystem/delfile#example) [Safe Delete](https://docs.volt.bz/docs/filesystem/delfile#safe-delete) [Related Functions](https://docs.volt.bz/docs/filesystem/delfile#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) compareinstances ================ Compares if two references point to the same instance. [Syntax](https://docs.volt.bz/docs/instances/compareinstances#syntax) ---------------------------------------------------------------------- compareinstances(a: Instance, b: Instance) -> boolean [Parameters](https://docs.volt.bz/docs/instances/compareinstances#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `a` | `Instance` | First instance reference | | `b` | `Instance` | Second instance reference | [Returns](https://docs.volt.bz/docs/instances/compareinstances#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | `true` if both point to the same instance | [Description](https://docs.volt.bz/docs/instances/compareinstances#description) -------------------------------------------------------------------------------- `compareinstances` checks if two instance references point to the same underlying Roblox instance, even if they were created with `cloneref`. [Example](https://docs.volt.bz/docs/instances/compareinstances#example) ------------------------------------------------------------------------ local part = workspace.Part local clone = cloneref(part) local other = workspace.OtherPart -- Normal comparison fails for cloneref print(part == clone) -- false -- compareinstances works correctly print(compareinstances(part, clone)) -- true print(compareinstances(part, other)) -- false [Use Case](https://docs.volt.bz/docs/instances/compareinstances#use-case) -------------------------------------------------------------------------- local function findInTable(tbl, target) for _, item in ipairs(tbl) do if typeof(item) == "Instance" and compareinstances(item, target) then return true end end return false end [Related Functions](https://docs.volt.bz/docs/instances/compareinstances#related-functions) -------------------------------------------------------------------------------------------- * [`cloneref`](https://docs.volt.bz/docs/instances/cloneref) - Clone an instance reference [cloneref\ \ Previous Page](https://docs.volt.bz/docs/instances/cloneref) [fireclickdetector\ \ Next Page](https://docs.volt.bz/docs/instances/fireclickdetector) ### On this page [Syntax](https://docs.volt.bz/docs/instances/compareinstances#syntax) [Parameters](https://docs.volt.bz/docs/instances/compareinstances#parameters) [Returns](https://docs.volt.bz/docs/instances/compareinstances#returns) [Description](https://docs.volt.bz/docs/instances/compareinstances#description) [Example](https://docs.volt.bz/docs/instances/compareinstances#example) [Use Case](https://docs.volt.bz/docs/instances/compareinstances#use-case) [Related Functions](https://docs.volt.bz/docs/instances/compareinstances#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) isparallel ========== Checks if the current thread is running in parallel. [Syntax](https://docs.volt.bz/docs/actors/isparallel#syntax) ------------------------------------------------------------- isparallel() -> boolean [Aliases](https://docs.volt.bz/docs/actors/isparallel#aliases) --------------------------------------------------------------- * `is_parallel` [Returns](https://docs.volt.bz/docs/actors/isparallel#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if running in a parallel context | [Description](https://docs.volt.bz/docs/actors/isparallel#description) ----------------------------------------------------------------------- `isparallel` returns whether the current code is executing in a parallel Luau context (inside an Actor). [Example](https://docs.volt.bz/docs/actors/isparallel#example) --------------------------------------------------------------- if isparallel() then print("Running in parallel!") -- Safe to do parallel-safe operations else print("Running on main thread") end [Use in Actor](https://docs.volt.bz/docs/actors/isparallel#use-in-actor) ------------------------------------------------------------------------- run_on_actor(someActor, [[\ print("Is parallel:", isparallel()) -- true\ ]]) print("Is parallel:", isparallel()) -- false (main thread) [Notes](https://docs.volt.bz/docs/actors/isparallel#notes) ----------------------------------------------------------- * Returns `false` on the main game thread * Returns `true` when running inside an actor via `run_on_actor` [Related Functions](https://docs.volt.bz/docs/actors/isparallel#related-functions) ----------------------------------------------------------------------------------- * [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) - Run code on an actor * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all actors [getluastate\ \ Previous Page](https://docs.volt.bz/docs/actors/getluastate) [on\_actor\_added\ \ Next Page](https://docs.volt.bz/docs/actors/on_actor_added) ### On this page [Syntax](https://docs.volt.bz/docs/actors/isparallel#syntax) [Aliases](https://docs.volt.bz/docs/actors/isparallel#aliases) [Returns](https://docs.volt.bz/docs/actors/isparallel#returns) [Description](https://docs.volt.bz/docs/actors/isparallel#description) [Example](https://docs.volt.bz/docs/actors/isparallel#example) [Use in Actor](https://docs.volt.bz/docs/actors/isparallel#use-in-actor) [Notes](https://docs.volt.bz/docs/actors/isparallel#notes) [Related Functions](https://docs.volt.bz/docs/actors/isparallel#related-functions) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy.IsActorState ========================== Whether this state was created for use by Actors. [Syntax](https://docs.volt.bz/docs/luastateproxy/isactorstate#syntax) ---------------------------------------------------------------------- state.IsActorState: boolean [Description](https://docs.volt.bz/docs/luastateproxy/isactorstate#description) -------------------------------------------------------------------------------- `LuaStateProxy.IsActorState` is a read-only boolean property that indicates whether the Lua state was created for use by Actors. Returns `true` for actor states and `false` for the main game state. [Example](https://docs.volt.bz/docs/luastateproxy/isactorstate#example) ------------------------------------------------------------------------ local state = getluastate() if state.IsActorState then print("This is an actor state") else print("This is the game state") end [Filter Actor States](https://docs.volt.bz/docs/luastateproxy/isactorstate#filter-actor-states) ------------------------------------------------------------------------------------------------ local states = getactorstates() local actorStates = {} for _, state in ipairs(states) do if state.IsActorState then table.insert(actorStates, state) print("Actor state ID:", state.Id) end end print("Total actor states:", #actorStates) [Conditional Behavior](https://docs.volt.bz/docs/luastateproxy/isactorstate#conditional-behavior) -------------------------------------------------------------------------------------------------- local state = getluastate() if state.IsActorState then -- Actor-specific logic print("Running on actor state") local actors = state:GetActors() print("Actors in state:", #actors) else -- Game state logic print("Running on game state") end [Related Properties](https://docs.volt.bz/docs/luastateproxy/isactorstate#related-properties) ---------------------------------------------------------------------------------------------- * [`LuaStateProxy.Id`](https://docs.volt.bz/docs/luastateproxy/id) - Unique state identifier * [`LuaStateProxy:GetActors`](https://docs.volt.bz/docs/luastateproxy/getactors) - Get actors for this state [LuaStateProxy.Id\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/id) [LuaStateProxy.new\ \ Next Page](https://docs.volt.bz/docs/luastateproxy/new) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/isactorstate#syntax) [Description](https://docs.volt.bz/docs/luastateproxy/isactorstate#description) [Example](https://docs.volt.bz/docs/luastateproxy/isactorstate#example) [Filter Actor States](https://docs.volt.bz/docs/luastateproxy/isactorstate#filter-actor-states) [Conditional Behavior](https://docs.volt.bz/docs/luastateproxy/isactorstate#conditional-behavior) [Related Properties](https://docs.volt.bz/docs/luastateproxy/isactorstate#related-properties) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) hookfunction ============ Replaces a function with a custom implementation. [Syntax](https://docs.volt.bz/docs/closures/hookfunction#syntax) ----------------------------------------------------------------- hookfunction(target: function, hook: function) -> function [Parameters](https://docs.volt.bz/docs/closures/hookfunction#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `target` | `function` | The function to hook | | `hook` | `function` | The replacement function | [Returns](https://docs.volt.bz/docs/closures/hookfunction#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `function` | A reference to the original function | [Description](https://docs.volt.bz/docs/closures/hookfunction#description) --------------------------------------------------------------------------- `hookfunction` replaces the target function with your hook function. All calls to the original function will now go through your hook instead. The function returns a reference to the original, allowing you to call it from within your hook. [Example](https://docs.volt.bz/docs/closures/hookfunction#example) ------------------------------------------------------------------- -- Hook the print function local originalPrint = hookfunction(print, function(...) originalPrint("[PREFIX]", ...) end) print("Hello") -- Output: [PREFIX] Hello -- You can still use the original originalPrint("Direct call") -- Output: Direct call [Advanced Example](https://docs.volt.bz/docs/closures/hookfunction#advanced-example) ------------------------------------------------------------------------------------- -- Hook a game method local oldNamecall oldNamecall = hookfunction( getrawmetatable(game).__namecall, newcclosure(function(self, ...) local method = getnamecallmethod() if method == "Kick" then return -- Block kick end return oldNamecall(self, ...) end) ) [Notes](https://docs.volt.bz/docs/closures/hookfunction#notes) --------------------------------------------------------------- * Use `checkcaller` to differentiate between your calls and game calls * Automatically wrapps Luau hooks in `newcclosure` when hooking C closures * The returned original can be called to bypass the hook * Restore the hook with `restorefunction` [getfunctionhash\ \ Previous Page](https://docs.volt.bz/docs/closures/getfunctionhash) [hookmetamethod\ \ Next Page](https://docs.volt.bz/docs/closures/hookmetamethod) ### On this page [Syntax](https://docs.volt.bz/docs/closures/hookfunction#syntax) [Parameters](https://docs.volt.bz/docs/closures/hookfunction#parameters) [Returns](https://docs.volt.bz/docs/closures/hookfunction#returns) [Description](https://docs.volt.bz/docs/closures/hookfunction#description) [Example](https://docs.volt.bz/docs/closures/hookfunction#example) [Advanced Example](https://docs.volt.bz/docs/closures/hookfunction#advanced-example) [Notes](https://docs.volt.bz/docs/closures/hookfunction#notes) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getconstant ================= Gets a constant from a function at the specified index. [Syntax](https://docs.volt.bz/docs/debug/getconstant#syntax) ------------------------------------------------------------- debug.getconstant(func: function | number, index: number) -> any [Parameters](https://docs.volt.bz/docs/debug/getconstant#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | | `index` | `number` | The constant index (1-based) | [Returns](https://docs.volt.bz/docs/debug/getconstant#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `any` | The constant value at the specified index | [Description](https://docs.volt.bz/docs/debug/getconstant#description) ----------------------------------------------------------------------- `debug.getconstant` retrieves a constant value from a function's bytecode. Constants are literal values like strings, numbers, and booleans that are embedded in the compiled function. [Example](https://docs.volt.bz/docs/debug/getconstant#example) --------------------------------------------------------------- local function example() local x = "hello" local y = 42 print(x, y) end -- Get constants from the function print(debug.getconstant(example, 1)) -- "hello" print(debug.getconstant(example, 2)) -- 42 print(debug.getconstant(example, 3)) -- "print" (function name) [Using Stack Level](https://docs.volt.bz/docs/debug/getconstant#using-stack-level) ----------------------------------------------------------------------------------- You can also pass a stack level instead of a function: local function inner() -- Get constant from the calling function (level 2) print(debug.getconstant(2, 1)) end local function outer() local msg = "from outer" inner() end outer() -- Prints a constant from outer [Notes](https://docs.volt.bz/docs/debug/getconstant#notes) ----------------------------------------------------------- * Index is 1-based * Not all indices may have constants (some may be nil) * Only works with Luau closures [Related Functions](https://docs.volt.bz/docs/debug/getconstant#related-functions) ----------------------------------------------------------------------------------- * [`debug.getconstants`](https://docs.volt.bz/docs/debug/getconstants) - Get all constants * [`debug.setconstant`](https://docs.volt.bz/docs/debug/setconstant) - Modify a constant [debug.getcallstack\ \ Previous Page](https://docs.volt.bz/docs/debug/getcallstack) [debug.getconstants\ \ Next Page](https://docs.volt.bz/docs/debug/getconstants) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getconstant#syntax) [Parameters](https://docs.volt.bz/docs/debug/getconstant#parameters) [Returns](https://docs.volt.bz/docs/debug/getconstant#returns) [Description](https://docs.volt.bz/docs/debug/getconstant#description) [Example](https://docs.volt.bz/docs/debug/getconstant#example) [Using Stack Level](https://docs.volt.bz/docs/debug/getconstant#using-stack-level) [Notes](https://docs.volt.bz/docs/debug/getconstant#notes) [Related Functions](https://docs.volt.bz/docs/debug/getconstant#related-functions) --- # Volt Documentation [VoltSignal](https://docs.volt.bz/docs/voltsignal) VoltSignal:Wait =============== Yields the current thread until the signal fires. [Syntax](https://docs.volt.bz/docs/voltsignal/wait#syntax) ----------------------------------------------------------- VoltSignal:Wait() -> any [Parameters](https://docs.volt.bz/docs/voltsignal/wait#parameters) ------------------------------------------------------------------- This method takes no parameters. [Returns](https://docs.volt.bz/docs/voltsignal/wait#returns) ------------------------------------------------------------- | Type | Description | | --- | --- | | `any` | The arguments passed to `Fire` | [Description](https://docs.volt.bz/docs/voltsignal/wait#description) --------------------------------------------------------------------- `VoltSignal:Wait` pauses the current thread until the signal is fired. When the signal fires, the thread resumes and returns any arguments that were passed to `Fire`. [Example](https://docs.volt.bz/docs/voltsignal/wait#example) ------------------------------------------------------------- local signal = VoltSignal.new() -- In another thread, fire after 2 seconds task.spawn(function() task.wait(2) signal:Fire("Data loaded!", 100) end) -- Wait for the signal local message, value = signal:Wait() print(message, value) -- Output (after 2 seconds): Data loaded! 100 [Timeout Pattern](https://docs.volt.bz/docs/voltsignal/wait#timeout-pattern) ----------------------------------------------------------------------------- local signal = VoltSignal.new() local result local timedOut = false task.spawn(function() result = signal:Wait() end) task.spawn(function() task.wait(5) if not result then timedOut = true -- Handle timeout end end) [Related Functions](https://docs.volt.bz/docs/voltsignal/wait#related-functions) --------------------------------------------------------------------------------- * [`VoltSignal:Fire`](https://docs.volt.bz/docs/voltsignal/fire) - Fire the signal * [`VoltSignal:Connect`](https://docs.volt.bz/docs/voltsignal/connect) - Connect without yielding [VoltSignal.new\ \ Previous Page](https://docs.volt.bz/docs/voltsignal/new) [WebSocket\ \ Next Page](https://docs.volt.bz/docs/websocket) ### On this page [Syntax](https://docs.volt.bz/docs/voltsignal/wait#syntax) [Parameters](https://docs.volt.bz/docs/voltsignal/wait#parameters) [Returns](https://docs.volt.bz/docs/voltsignal/wait#returns) [Description](https://docs.volt.bz/docs/voltsignal/wait#description) [Example](https://docs.volt.bz/docs/voltsignal/wait#example) [Timeout Pattern](https://docs.volt.bz/docs/voltsignal/wait#timeout-pattern) [Related Functions](https://docs.volt.bz/docs/voltsignal/wait#related-functions) --- # Volt Documentation [WebSocket](https://docs.volt.bz/docs/websocket) WebSocket.OnMessage =================== Signal that fires when a message is received from the server. [Syntax](https://docs.volt.bz/docs/websocket/onmessage#syntax) --------------------------------------------------------------- WebSocket.OnMessage:Connect(callback: (message: string) -> ()) -> Connection [Callback Parameters](https://docs.volt.bz/docs/websocket/onmessage#callback-parameters) ----------------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `message` | `string` | The received message | [Returns](https://docs.volt.bz/docs/websocket/onmessage#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `Connection` | A connection that can be disconnected | [Description](https://docs.volt.bz/docs/websocket/onmessage#description) ------------------------------------------------------------------------- `OnMessage` is a signal that fires whenever the WebSocket server sends a message. Connect a handler function to process incoming messages. [Example](https://docs.volt.bz/docs/websocket/onmessage#example) ----------------------------------------------------------------- local ws = WebSocket.connect("wss://echo.websocket.org") ws.OnMessage:Connect(function(message) print("Received:", message) end) ws:Send("Hello!") -- Output: Received: Hello! [JSON Messages](https://docs.volt.bz/docs/websocket/onmessage#json-messages) ----------------------------------------------------------------------------- local HttpService = game:GetService("HttpService") local ws = WebSocket.connect("wss://api.example.com/ws") ws.OnMessage:Connect(function(message) local data = HttpService:JSONDecode(message) if data.type == "update" then print("Update:", data.payload) elseif data.type == "error" then warn("Error:", data.message) end end) [Message Queue Pattern](https://docs.volt.bz/docs/websocket/onmessage#message-queue-pattern) --------------------------------------------------------------------------------------------- local ws = WebSocket.connect("wss://example.com/socket") local messageQueue = {} ws.OnMessage:Connect(function(message) table.insert(messageQueue, { content = message, time = os.time() }) end) -- Process messages elsewhere local function processQueue() for _, msg in ipairs(messageQueue) do print(msg.time, msg.content) end table.clear(messageQueue) end [Related](https://docs.volt.bz/docs/websocket/onmessage#related) ----------------------------------------------------------------- * [`WebSocket.connect`](https://docs.volt.bz/docs/websocket/connect) - Create connection * [`WebSocket:Send`](https://docs.volt.bz/docs/websocket/send) - Send messages * [`OnClose`](https://docs.volt.bz/docs/websocket/onclose) - Connection close event [WebSocket.OnClose\ \ Previous Page](https://docs.volt.bz/docs/websocket/onclose) [WebSocket:Send\ \ Next Page](https://docs.volt.bz/docs/websocket/send) ### On this page [Syntax](https://docs.volt.bz/docs/websocket/onmessage#syntax) [Callback Parameters](https://docs.volt.bz/docs/websocket/onmessage#callback-parameters) [Returns](https://docs.volt.bz/docs/websocket/onmessage#returns) [Description](https://docs.volt.bz/docs/websocket/onmessage#description) [Example](https://docs.volt.bz/docs/websocket/onmessage#example) [JSON Messages](https://docs.volt.bz/docs/websocket/onmessage#json-messages) [Message Queue Pattern](https://docs.volt.bz/docs/websocket/onmessage#message-queue-pattern) [Related](https://docs.volt.bz/docs/websocket/onmessage#related) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) isreadonly ========== Checks if a table is read-only. [Syntax](https://docs.volt.bz/docs/metatable/isreadonly#syntax) ---------------------------------------------------------------- isreadonly(table: table) -> boolean [Parameters](https://docs.volt.bz/docs/metatable/isreadonly#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `table` | `table` | The table to check | [Returns](https://docs.volt.bz/docs/metatable/isreadonly#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | `true` if the table is read-only | [Description](https://docs.volt.bz/docs/metatable/isreadonly#description) -------------------------------------------------------------------------- `isreadonly` returns whether a table has been marked as read-only, preventing modifications. [Example](https://docs.volt.bz/docs/metatable/isreadonly#example) ------------------------------------------------------------------ local mt = getrawmetatable(game) print(isreadonly(mt)) -- true (Roblox metatables are locked) -- Normal tables are not read-only by default local myTable = {a = 1} print(isreadonly(myTable)) -- false [Before Modifying](https://docs.volt.bz/docs/metatable/isreadonly#before-modifying) ------------------------------------------------------------------------------------ local mt = getrawmetatable(game) if isreadonly(mt) then setreadonly(mt, false) -- Now safe to modify mt.__index = myCustomIndex setreadonly(mt, true) end [Related Functions](https://docs.volt.bz/docs/metatable/isreadonly#related-functions) -------------------------------------------------------------------------------------- * [`setreadonly`](https://docs.volt.bz/docs/metatable/setreadonly) - Set read-only status * [`getrawmetatable`](https://docs.volt.bz/docs/metatable/getrawmetatable) - Get the metatable [getrawmetatable\ \ Previous Page](https://docs.volt.bz/docs/metatable/getrawmetatable) [iswritable\ \ Next Page](https://docs.volt.bz/docs/metatable/iswritable) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/isreadonly#syntax) [Parameters](https://docs.volt.bz/docs/metatable/isreadonly#parameters) [Returns](https://docs.volt.bz/docs/metatable/isreadonly#returns) [Description](https://docs.volt.bz/docs/metatable/isreadonly#description) [Example](https://docs.volt.bz/docs/metatable/isreadonly#example) [Before Modifying](https://docs.volt.bz/docs/metatable/isreadonly#before-modifying) [Related Functions](https://docs.volt.bz/docs/metatable/isreadonly#related-functions) --- # Volt Documentation [Environment](https://docs.volt.bz/docs/environment) gettenv ======= Gets the environment of a thread. [Syntax](https://docs.volt.bz/docs/environment/gettenv#syntax) --------------------------------------------------------------- gettenv(thread: thread?) -> table [Parameters](https://docs.volt.bz/docs/environment/gettenv#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `thread` | `thread` | (Optional) Thread, defaults to current | [Returns](https://docs.volt.bz/docs/environment/gettenv#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | The thread's environment | [Description](https://docs.volt.bz/docs/environment/gettenv#description) ------------------------------------------------------------------------- `gettenv` returns the environment table for the specified thread. If no thread is provided, returns the current thread's environment. [Example](https://docs.volt.bz/docs/environment/gettenv#example) ----------------------------------------------------------------- -- Get current thread's environment local env = gettenv() print(env.print) -- The print function -- Get another thread's environment local thread = coroutine.create(function() end) local threadEnv = gettenv(thread) [Related Functions](https://docs.volt.bz/docs/environment/gettenv#related-functions) ------------------------------------------------------------------------------------- * [`getgenv`](https://docs.volt.bz/docs/environment/getgenv) - Get global environment * [`getrenv`](https://docs.volt.bz/docs/environment/getrenv) - Get Roblox environment [getrenv\ \ Previous Page](https://docs.volt.bz/docs/environment/getrenv) [Filesystem\ \ Next Page](https://docs.volt.bz/docs/filesystem) ### On this page [Syntax](https://docs.volt.bz/docs/environment/gettenv#syntax) [Parameters](https://docs.volt.bz/docs/environment/gettenv#parameters) [Returns](https://docs.volt.bz/docs/environment/gettenv#returns) [Description](https://docs.volt.bz/docs/environment/gettenv#description) [Example](https://docs.volt.bz/docs/environment/gettenv#example) [Related Functions](https://docs.volt.bz/docs/environment/gettenv#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) getconnections ============== Gets all connections to a signal. [Syntax](https://docs.volt.bz/docs/signals/getconnections#syntax) ------------------------------------------------------------------ getconnections(signal: RBXScriptSignal) -> {Connection} [Parameters](https://docs.volt.bz/docs/signals/getconnections#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal | [Returns](https://docs.volt.bz/docs/signals/getconnections#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `{Connection}` | Array of Connection objects | [Description](https://docs.volt.bz/docs/signals/getconnections#description) ---------------------------------------------------------------------------- `getconnections` returns all current connections to a signal, allowing you to inspect, fire, disable, or disconnect them individually. [Example](https://docs.volt.bz/docs/signals/getconnections#example) -------------------------------------------------------------------- local connections = getconnections(game.Players.PlayerAdded) print("Total connections:", #connections) for i, conn in ipairs(connections) do print(i, "Enabled:", conn.Enabled) end [Disconnecting All](https://docs.volt.bz/docs/signals/getconnections#disconnecting-all) ---------------------------------------------------------------------------------------- local function disconnectAll(signal) for _, conn in ipairs(getconnections(signal)) do conn:Disconnect() end end -- Disconnect all PlayerAdded handlers disconnectAll(game.Players.PlayerAdded) [Disabling Specific Connections](https://docs.volt.bz/docs/signals/getconnections#disabling-specific-connections) ------------------------------------------------------------------------------------------------------------------ local connections = getconnections(workspace.Part.Touched) for _, conn in ipairs(connections) do if conn.Function then -- Check if it's the function we want to disable conn:Disable() end end [Inspecting Connection Functions](https://docs.volt.bz/docs/signals/getconnections#inspecting-connection-functions) -------------------------------------------------------------------------------------------------------------------- local connections = getconnections(someEvent) for _, conn in ipairs(connections) do if conn.LuaConnection and conn.Function then print("Found Lua connection") local constants = debug.getconstants(conn.Function) print("Constants:", table.concat(constants, ", ")) end end [The Connection Object](https://docs.volt.bz/docs/signals/getconnections#the-connection-object) ------------------------------------------------------------------------------------------------ Each connection returned has the following properties and methods: | Property/Method | Type | Description | | --- | --- | --- | | `Enabled` | `boolean` | Whether the connection is active | | `ForeignState` | `boolean` | Whether it's from a different Luau state | | `LuaConnection` | `boolean` | Whether it's a Lua connection | | `Function` | `function` | The connected function (if accessible) | | `Thread` | `thread` | The connection's thread | | `Fire(...)` | `method` | Fire this connection only | | `Defer(...)` | `method` | Deferred fire | | `Disconnect()` | `method` | Disconnect this connection | | `Disable()` | `method` | Temporarily disable | | `Enable()` | `method` | Re-enable after disable | [Related Functions](https://docs.volt.bz/docs/signals/getconnections#related-functions) ---------------------------------------------------------------------------------------- * [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) - Fire all connections [firesignal\ \ Previous Page](https://docs.volt.bz/docs/signals/firesignal) [getsignalarguments\ \ Next Page](https://docs.volt.bz/docs/signals/getsignalarguments) ### On this page [Syntax](https://docs.volt.bz/docs/signals/getconnections#syntax) [Parameters](https://docs.volt.bz/docs/signals/getconnections#parameters) [Returns](https://docs.volt.bz/docs/signals/getconnections#returns) [Description](https://docs.volt.bz/docs/signals/getconnections#description) [Example](https://docs.volt.bz/docs/signals/getconnections#example) [Disconnecting All](https://docs.volt.bz/docs/signals/getconnections#disconnecting-all) [Disabling Specific Connections](https://docs.volt.bz/docs/signals/getconnections#disabling-specific-connections) [Inspecting Connection Functions](https://docs.volt.bz/docs/signals/getconnections#inspecting-connection-functions) [The Connection Object](https://docs.volt.bz/docs/signals/getconnections#the-connection-object) [Related Functions](https://docs.volt.bz/docs/signals/getconnections#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) keyclick ======== Simulates a complete key press and release. [Syntax](https://docs.volt.bz/docs/input/keyclick#syntax) ---------------------------------------------------------- keyclick(keycode: number) -> void [Parameters](https://docs.volt.bz/docs/input/keyclick#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `keycode` | `number` | Virtual key code | [Returns](https://docs.volt.bz/docs/input/keyclick#returns) ------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/input/keyclick#description) -------------------------------------------------------------------- `keyclick` simulates pressing and releasing a keyboard key in one operation. [Example](https://docs.volt.bz/docs/input/keyclick#example) ------------------------------------------------------------ -- Click the E key keyclick(0x45) -- Click space multiple times for i = 1, 5 do keyclick(0x20) task.wait(0.1) end [Related Functions](https://docs.volt.bz/docs/input/keyclick#related-functions) -------------------------------------------------------------------------------- * [`keypress`](https://docs.volt.bz/docs/input/keypress) - Press a key * [`keyrelease`](https://docs.volt.bz/docs/input/keyrelease) - Release a key [iswindowactive\ \ Previous Page](https://docs.volt.bz/docs/input/iswindowactive) [keypress\ \ Next Page](https://docs.volt.bz/docs/input/keypress) ### On this page [Syntax](https://docs.volt.bz/docs/input/keyclick#syntax) [Parameters](https://docs.volt.bz/docs/input/keyclick#parameters) [Returns](https://docs.volt.bz/docs/input/keyclick#returns) [Description](https://docs.volt.bz/docs/input/keyclick#description) [Example](https://docs.volt.bz/docs/input/keyclick#example) [Related Functions](https://docs.volt.bz/docs/input/keyclick#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) fireclickdetector ================= Triggers a ClickDetector as if it was clicked. [Syntax](https://docs.volt.bz/docs/instances/fireclickdetector#syntax) ----------------------------------------------------------------------- fireclickdetector(detector: ClickDetector, distance?: number, event?: string) -> void [Parameters](https://docs.volt.bz/docs/instances/fireclickdetector#parameters) ------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `detector` | `ClickDetector` | The ClickDetector to fire | | `distance` | `number?` | The simulated click distance (default: 0) | | `event` | `string?` | Event type: "MouseClick", "RightMouseClick", or "MouseHoverEnter/Leave" | [Returns](https://docs.volt.bz/docs/instances/fireclickdetector#returns) ------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/instances/fireclickdetector#description) --------------------------------------------------------------------------------- `fireclickdetector` simulates a click on a ClickDetector, triggering its events without needing to be in range or actually clicking. [Example](https://docs.volt.bz/docs/instances/fireclickdetector#example) ------------------------------------------------------------------------- -- Find a ClickDetector local detector = workspace.Button.ClickDetector -- Fire it fireclickdetector(detector) -- Fire with distance fireclickdetector(detector, 10) -- Fire right click fireclickdetector(detector, 0, "RightMouseClick") [Finding and Clicking All](https://docs.volt.bz/docs/instances/fireclickdetector#finding-and-clicking-all) ----------------------------------------------------------------------------------------------------------- -- Click all ClickDetectors in a model local function clickAll(parent) for _, desc in ipairs(parent:GetDescendants()) do if desc:IsA("ClickDetector") then fireclickdetector(desc) end end end clickAll(workspace.Shop) [Notes](https://docs.volt.bz/docs/instances/fireclickdetector#notes) --------------------------------------------------------------------- * Distance is used for MaxActivationDistance checks in some games * Events: "MouseClick" (default), "RightMouseClick", "MouseHoverEnter", "MouseHoverLeave" [compareinstances\ \ Previous Page](https://docs.volt.bz/docs/instances/compareinstances) [fireproximityprompt\ \ Next Page](https://docs.volt.bz/docs/instances/fireproximityprompt) ### On this page [Syntax](https://docs.volt.bz/docs/instances/fireclickdetector#syntax) [Parameters](https://docs.volt.bz/docs/instances/fireclickdetector#parameters) [Returns](https://docs.volt.bz/docs/instances/fireclickdetector#returns) [Description](https://docs.volt.bz/docs/instances/fireclickdetector#description) [Example](https://docs.volt.bz/docs/instances/fireclickdetector#example) [Finding and Clicking All](https://docs.volt.bz/docs/instances/fireclickdetector#finding-and-clicking-all) [Notes](https://docs.volt.bz/docs/instances/fireclickdetector#notes) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getcallingscript ================ Returns the script that called the current function. [Syntax](https://docs.volt.bz/docs/scripts/getcallingscript#syntax) -------------------------------------------------------------------- getcallingscript() -> LocalScript | ModuleScript | nil [Returns](https://docs.volt.bz/docs/scripts/getcallingscript#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `LocalScript` or `ModuleScript` or `nil` | The calling script | [Description](https://docs.volt.bz/docs/scripts/getcallingscript#description) ------------------------------------------------------------------------------ `getcallingscript` returns a reference to the script that invoked the current function. This is useful in hooks to identify which script triggered the call. [Example](https://docs.volt.bz/docs/scripts/getcallingscript#example) ---------------------------------------------------------------------- local oldPrint = print print = function(...) local caller = getcallingscript() if caller then oldPrint("[" .. caller.Name .. "]", ...) else oldPrint("[Unknown]", ...) end end -- When a game script calls print, it shows which script [In Metamethod Hooks](https://docs.volt.bz/docs/scripts/getcallingscript#in-metamethod-hooks) ---------------------------------------------------------------------------------------------- local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local caller = getcallingscript() local method = getnamecallmethod() if caller then print("Script:", caller:GetFullName()) print("Method:", method) end return oldNamecall(self, ...) end)) [Notes](https://docs.volt.bz/docs/scripts/getcallingscript#notes) ------------------------------------------------------------------ * Returns nil if called from volt (not from a game script) * Useful for filtering hooks based on the calling script * Works in hooked functions and metamethods [Scripts\ \ Previous Page](https://docs.volt.bz/docs/scripts) [getloadedmodules\ \ Next Page](https://docs.volt.bz/docs/scripts/getloadedmodules) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getcallingscript#syntax) [Returns](https://docs.volt.bz/docs/scripts/getcallingscript#returns) [Description](https://docs.volt.bz/docs/scripts/getcallingscript#description) [Example](https://docs.volt.bz/docs/scripts/getcallingscript#example) [In Metamethod Hooks](https://docs.volt.bz/docs/scripts/getcallingscript#in-metamethod-hooks) [Notes](https://docs.volt.bz/docs/scripts/getcallingscript#notes) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) gethiddenproperty ================= Gets the value of a hidden property. [Syntax](https://docs.volt.bz/docs/reflection/gethiddenproperty#syntax) ------------------------------------------------------------------------ gethiddenproperty(instance: Instance, property: string) -> any, boolean [Parameters](https://docs.volt.bz/docs/reflection/gethiddenproperty#parameters) -------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance | | `property` | `string` | The hidden property name | [Returns](https://docs.volt.bz/docs/reflection/gethiddenproperty#returns) -------------------------------------------------------------------------- | Type | Description | | --- | --- | | `any` | The property value | | `boolean` | Whether the property was hidden | [Description](https://docs.volt.bz/docs/reflection/gethiddenproperty#description) ---------------------------------------------------------------------------------- `gethiddenproperty` retrieves the value of a property that isn't normally accessible through scripts. [Example](https://docs.volt.bz/docs/reflection/gethiddenproperty#example) -------------------------------------------------------------------------- local part = Instance.new("Part") -- Get a hidden property local value, wasHidden = gethiddenproperty(part, "size_xml") print("Value:", value) print("Was hidden:", wasHidden) [Common Hidden Properties](https://docs.volt.bz/docs/reflection/gethiddenproperty#common-hidden-properties) ------------------------------------------------------------------------------------------------------------ | Class | Property | Description | | --- | --- | --- | | `LocalScript` | `Bytecode` | Compiled bytecode | | `Sound` | `RollOffMode` | Sound falloff mode | | `Humanoid` | `InternalHeadScale` | Internal head scaling | [Finding Hidden Properties](https://docs.volt.bz/docs/reflection/gethiddenproperty#finding-hidden-properties) -------------------------------------------------------------------------------------------------------------- -- Example of reading protected properties local player = game.Players.LocalPlayer local character = player.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then local internal = gethiddenproperty(humanoid, "InternalHeadScale") print("Internal head scale:", internal) end end [Related Functions](https://docs.volt.bz/docs/reflection/gethiddenproperty#related-functions) ---------------------------------------------------------------------------------------------- * [`sethiddenproperty`](https://docs.volt.bz/docs/reflection/sethiddenproperty) - Set a hidden property * [`isscriptable`](https://docs.volt.bz/docs/reflection/isscriptable) - Check if property is scriptable [gethiddenproperties\ \ Previous Page](https://docs.volt.bz/docs/reflection/gethiddenproperties) [getproperties\ \ Next Page](https://docs.volt.bz/docs/reflection/getproperties) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/gethiddenproperty#syntax) [Parameters](https://docs.volt.bz/docs/reflection/gethiddenproperty#parameters) [Returns](https://docs.volt.bz/docs/reflection/gethiddenproperty#returns) [Description](https://docs.volt.bz/docs/reflection/gethiddenproperty#description) [Example](https://docs.volt.bz/docs/reflection/gethiddenproperty#example) [Common Hidden Properties](https://docs.volt.bz/docs/reflection/gethiddenproperty#common-hidden-properties) [Finding Hidden Properties](https://docs.volt.bz/docs/reflection/gethiddenproperty#finding-hidden-properties) [Related Functions](https://docs.volt.bz/docs/reflection/gethiddenproperty#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) iswritable ========== Checks if a table is writable (not read-only). [Syntax](https://docs.volt.bz/docs/metatable/iswritable#syntax) ---------------------------------------------------------------- iswritable(table: table) -> boolean [Parameters](https://docs.volt.bz/docs/metatable/iswritable#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `table` | `table` | The table to check | [Returns](https://docs.volt.bz/docs/metatable/iswritable#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | True if the table can be modified | [Description](https://docs.volt.bz/docs/metatable/iswritable#description) -------------------------------------------------------------------------- `iswritable` checks whether a table can be modified. This is the inverse of `isreadonly` - it returns `true` when `isreadonly` would return `false`, and vice versa. [Example](https://docs.volt.bz/docs/metatable/iswritable#example) ------------------------------------------------------------------ local myTable = {value = 123} print(iswritable(myTable)) -- true makereadonly(myTable) print(iswritable(myTable)) -- false makewritable(myTable) print(iswritable(myTable)) -- true [Metatable Example](https://docs.volt.bz/docs/metatable/iswritable#metatable-example) -------------------------------------------------------------------------------------- local mt = getrawmetatable(game) if iswritable(mt) then print("Metatable is writable") else print("Metatable is read-only") makewritable(mt) end [Notes](https://docs.volt.bz/docs/metatable/iswritable#notes) -------------------------------------------------------------- * Equivalent to `not isreadonly(table)` * Useful for checking before modifications [Related Functions](https://docs.volt.bz/docs/metatable/iswritable#related-functions) -------------------------------------------------------------------------------------- * [`isreadonly`](https://docs.volt.bz/docs/metatable/isreadonly) - Check if table is read-only * [`makewritable`](https://docs.volt.bz/docs/metatable/makewritable) - Make table writable * [`makereadonly`](https://docs.volt.bz/docs/metatable/makereadonly) - Make table read-only [isreadonly\ \ Previous Page](https://docs.volt.bz/docs/metatable/isreadonly) [makereadonly\ \ Next Page](https://docs.volt.bz/docs/metatable/makereadonly) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/iswritable#syntax) [Parameters](https://docs.volt.bz/docs/metatable/iswritable#parameters) [Returns](https://docs.volt.bz/docs/metatable/iswritable#returns) [Description](https://docs.volt.bz/docs/metatable/iswritable#description) [Example](https://docs.volt.bz/docs/metatable/iswritable#example) [Metatable Example](https://docs.volt.bz/docs/metatable/iswritable#metatable-example) [Notes](https://docs.volt.bz/docs/metatable/iswritable#notes) [Related Functions](https://docs.volt.bz/docs/metatable/iswritable#related-functions) --- # Volt Documentation [WebSocket](https://docs.volt.bz/docs/websocket) WebSocket:Send ============== Sends a message through the WebSocket connection. [Syntax](https://docs.volt.bz/docs/websocket/send#syntax) ---------------------------------------------------------- WebSocket:Send(message: string) -> () [Parameters](https://docs.volt.bz/docs/websocket/send#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `message` | `string` | The message to send | [Returns](https://docs.volt.bz/docs/websocket/send#returns) ------------------------------------------------------------ This method does not return a value. [Description](https://docs.volt.bz/docs/websocket/send#description) -------------------------------------------------------------------- `WebSocket:Send` transmits a string message to the connected WebSocket server. For structured data, encode it as JSON before sending. [Example](https://docs.volt.bz/docs/websocket/send#example) ------------------------------------------------------------ local ws = WebSocket.connect("wss://example.com/socket") -- Send a simple message ws:Send("Hello, Server!") [JSON Communication](https://docs.volt.bz/docs/websocket/send#json-communication) ---------------------------------------------------------------------------------- local HttpService = game:GetService("HttpService") local ws = WebSocket.connect("wss://api.example.com/ws") -- Send JSON data local function sendJSON(data) ws:Send(HttpService:JSONEncode(data)) end sendJSON({ type = "subscribe", channel = "updates" }) sendJSON({ type = "message", content = "Hello!", timestamp = os.time() }) [Multiple Messages](https://docs.volt.bz/docs/websocket/send#multiple-messages) -------------------------------------------------------------------------------- local ws = WebSocket.connect("wss://echo.websocket.org") ws.OnMessage:Connect(function(msg) print("Echo:", msg) end) -- Send multiple messages ws:Send("First message") ws:Send("Second message") ws:Send("Third message") [Notes](https://docs.volt.bz/docs/websocket/send#notes) -------------------------------------------------------- * Messages are strings; use JSON for structured data * Messages are sent asynchronously * Connection must be open to send [Related](https://docs.volt.bz/docs/websocket/send#related) ------------------------------------------------------------ * [`WebSocket.connect`](https://docs.volt.bz/docs/websocket/connect) - Create connection * [`OnMessage`](https://docs.volt.bz/docs/websocket/onmessage) - Receive responses [WebSocket.OnMessage\ \ Previous Page](https://docs.volt.bz/docs/websocket/onmessage) ### On this page [Syntax](https://docs.volt.bz/docs/websocket/send#syntax) [Parameters](https://docs.volt.bz/docs/websocket/send#parameters) [Returns](https://docs.volt.bz/docs/websocket/send#returns) [Description](https://docs.volt.bz/docs/websocket/send#description) [Example](https://docs.volt.bz/docs/websocket/send#example) [JSON Communication](https://docs.volt.bz/docs/websocket/send#json-communication) [Multiple Messages](https://docs.volt.bz/docs/websocket/send#multiple-messages) [Notes](https://docs.volt.bz/docs/websocket/send#notes) [Related](https://docs.volt.bz/docs/websocket/send#related) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) clearqueueonteleport ==================== Clears the teleport script queue. [Syntax](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#syntax) ------------------------------------------------------------------------------ clearqueueonteleport() -> void [Aliases](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#aliases) -------------------------------------------------------------------------------- * `clearteleportqueue` * `clear_teleport_queue` [Returns](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#returns) -------------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#description) ---------------------------------------------------------------------------------------- `clearqueueonteleport` removes any script that was queued to run after teleporting. [Example](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#example) -------------------------------------------------------------------------------- -- Queue a script queueonteleport("print('Hello after teleport')") -- Change our mind clearqueueonteleport() -- Now nothing will run after teleporting [Related Functions](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#related-functions) ---------------------------------------------------------------------------------------------------- * [`queueonteleport`](https://docs.volt.bz/docs/miscellaneous/queueonteleport) - Queue a teleport script [Miscellaneous\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous) [getfflag\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/getfflag) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#syntax) [Aliases](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#aliases) [Returns](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#returns) [Description](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#description) [Example](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#example) [Related Functions](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getconstants ================== Gets all constants from a function. [Syntax](https://docs.volt.bz/docs/debug/getconstants#syntax) -------------------------------------------------------------- debug.getconstants(func: function | number) -> table [Parameters](https://docs.volt.bz/docs/debug/getconstants#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | [Returns](https://docs.volt.bz/docs/debug/getconstants#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | An array of all constants in the function | [Description](https://docs.volt.bz/docs/debug/getconstants#description) ------------------------------------------------------------------------ `debug.getconstants` returns a table containing all constant values embedded in a function's bytecode. This is useful for inspecting what literal values a function uses. [Example](https://docs.volt.bz/docs/debug/getconstants#example) ---------------------------------------------------------------- local function greet(name) local greeting = "Hello" local punctuation = "!" return greeting .. ", " .. name .. punctuation end local constants = debug.getconstants(greet) for i, v in ipairs(constants) do print(i, type(v), v) end --[[\ Output:\ 1 string Hello\ 2 string !\ 3 string , \ ]] [Inspecting Game Functions](https://docs.volt.bz/docs/debug/getconstants#inspecting-game-functions) ---------------------------------------------------------------------------------------------------- -- Find what strings a function uses local function findStrings(func) local strings = {} for i, const in ipairs(debug.getconstants(func)) do if type(const) == "string" then table.insert(strings, const) end end return strings end [Notes](https://docs.volt.bz/docs/debug/getconstants#notes) ------------------------------------------------------------ * The table is indexed starting at 1 * Some indices may contain `nil` for unused constant slots * Only works with Luau closures [Related Functions](https://docs.volt.bz/docs/debug/getconstants#related-functions) ------------------------------------------------------------------------------------ * [`debug.getconstant`](https://docs.volt.bz/docs/debug/getconstant) - Get a single constant * [`debug.setconstant`](https://docs.volt.bz/docs/debug/setconstant) - Modify a constant [debug.getconstant\ \ Previous Page](https://docs.volt.bz/docs/debug/getconstant) [debug.getinfo\ \ Next Page](https://docs.volt.bz/docs/debug/getinfo) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getconstants#syntax) [Parameters](https://docs.volt.bz/docs/debug/getconstants#parameters) [Returns](https://docs.volt.bz/docs/debug/getconstants#returns) [Description](https://docs.volt.bz/docs/debug/getconstants#description) [Example](https://docs.volt.bz/docs/debug/getconstants#example) [Inspecting Game Functions](https://docs.volt.bz/docs/debug/getconstants#inspecting-game-functions) [Notes](https://docs.volt.bz/docs/debug/getconstants#notes) [Related Functions](https://docs.volt.bz/docs/debug/getconstants#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) delfolder ========= Deletes a folder and its contents. [Syntax](https://docs.volt.bz/docs/filesystem/delfolder#syntax) ---------------------------------------------------------------- delfolder(path: string) -> void [Parameters](https://docs.volt.bz/docs/filesystem/delfolder#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The folder path to delete | [Returns](https://docs.volt.bz/docs/filesystem/delfolder#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/filesystem/delfolder#description) -------------------------------------------------------------------------- `delfolder` permanently deletes a folder and all of its contents, including files and subfolders. [Example](https://docs.volt.bz/docs/filesystem/delfolder#example) ------------------------------------------------------------------ -- Create a folder structure makefolder("testfolder") writefile("testfolder/file1.txt", "Data 1") writefile("testfolder/file2.txt", "Data 2") -- Verify it exists print(isfolder("testfolder")) -- true -- Delete the entire folder delfolder("testfolder") -- Verify it's gone print(isfolder("testfolder")) -- false This operation is irreversible. All files and subfolders will be permanently deleted. [Related Functions](https://docs.volt.bz/docs/filesystem/delfolder#related-functions) -------------------------------------------------------------------------------------- * [`isfolder`](https://docs.volt.bz/docs/filesystem/isfolder) - Check if folder exists * [`delfile`](https://docs.volt.bz/docs/filesystem/delfile) - Delete a single file * [`makefolder`](https://docs.volt.bz/docs/filesystem/makefolder) - Create a folder [delfile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/delfile) [dofile\ \ Next Page](https://docs.volt.bz/docs/filesystem/dofile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/delfolder#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/delfolder#parameters) [Returns](https://docs.volt.bz/docs/filesystem/delfolder#returns) [Description](https://docs.volt.bz/docs/filesystem/delfolder#description) [Example](https://docs.volt.bz/docs/filesystem/delfolder#example) [Related Functions](https://docs.volt.bz/docs/filesystem/delfolder#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) on\_actor\_added ================ A bindable event that fires when an actor is added and ready. [Syntax](https://docs.volt.bz/docs/actors/on_actor_added#syntax) ----------------------------------------------------------------- on_actor_added: BindableEvent [Description](https://docs.volt.bz/docs/actors/on_actor_added#description) --------------------------------------------------------------------------- `on_actor_added` is a global BindableEvent that fires whenever a new actor is added to the game and its global state has been set up. This allows you to automatically run code on new actors as they're created. [Event Arguments](https://docs.volt.bz/docs/actors/on_actor_added#event-arguments) ----------------------------------------------------------------------------------- | Argument | Type | Description | | --- | --- | --- | | `actor` | `Actor` | The actor instance that was added | [Example](https://docs.volt.bz/docs/actors/on_actor_added#example) ------------------------------------------------------------------- on_actor_added.Event:Connect(function(actor) print("New actor added:", actor:GetFullName()) end) [Auto-Setup Actors](https://docs.volt.bz/docs/actors/on_actor_added#auto-setup-actors) --------------------------------------------------------------------------------------- -- Automatically run setup code on all new actors on_actor_added.Event:Connect(function(actor) run_on_actor(actor, [[\ -- Setup code for each actor\ print("Actor initialized!")\ ]]) end) [With Communication Channel](https://docs.volt.bz/docs/actors/on_actor_added#with-communication-channel) --------------------------------------------------------------------------------------------------------- local id, channel = create_comm_channel() channel.Event:Connect(function(actorName) print("Actor ready:", actorName) end) on_actor_added.Event:Connect(function(actor) run_on_actor(actor, [[\ local channelId = ...\ local channel = get_comm_channel(channelId)\ channel:Fire(script:GetFullName())\ ]], id) end) [Notes](https://docs.volt.bz/docs/actors/on_actor_added#notes) --------------------------------------------------------------- * Fires only after the actor's global state is fully initialized * Useful for setting up hooks or injecting code into new actors [Related Functions](https://docs.volt.bz/docs/actors/on_actor_added#related-functions) --------------------------------------------------------------------------------------- * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all existing actors * [`run_on_actor`](https://docs.volt.bz/docs/actors/run_on_actor) - Run code on an actor [isparallel\ \ Previous Page](https://docs.volt.bz/docs/actors/isparallel) [on\_actor\_state\_created\ \ Next Page](https://docs.volt.bz/docs/actors/on_actor_state_created) ### On this page [Syntax](https://docs.volt.bz/docs/actors/on_actor_added#syntax) [Description](https://docs.volt.bz/docs/actors/on_actor_added#description) [Event Arguments](https://docs.volt.bz/docs/actors/on_actor_added#event-arguments) [Example](https://docs.volt.bz/docs/actors/on_actor_added#example) [Auto-Setup Actors](https://docs.volt.bz/docs/actors/on_actor_added#auto-setup-actors) [With Communication Channel](https://docs.volt.bz/docs/actors/on_actor_added#with-communication-channel) [Notes](https://docs.volt.bz/docs/actors/on_actor_added#notes) [Related Functions](https://docs.volt.bz/docs/actors/on_actor_added#related-functions) --- # Volt Documentation [Crypt](https://docs.volt.bz/docs/crypt) crypt.random ============ Generates cryptographically secure random bytes. [Syntax](https://docs.volt.bz/docs/crypt/random#syntax) -------------------------------------------------------- crypt.random(length: number) -> string [Parameters](https://docs.volt.bz/docs/crypt/random#parameters) ---------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `length` | `number` | Number of random bytes to generate | [Returns](https://docs.volt.bz/docs/crypt/random#returns) ---------------------------------------------------------- | Type | Description | | --- | --- | | `string` | Random byte string | [Description](https://docs.volt.bz/docs/crypt/random#description) ------------------------------------------------------------------ `crypt.random` generates cryptographically secure random bytes, suitable for security-sensitive operations. [Example](https://docs.volt.bz/docs/crypt/random#example) ---------------------------------------------------------- -- Generate 16 random bytes local randomBytes = crypt.random(16) print("Random bytes length:", #randomBytes) -- Convert to hex for display local hex = "" for i = 1, #randomBytes do hex = hex .. string.format("%02x", string.byte(randomBytes, i)) end print("Hex:", hex) [Use Cases](https://docs.volt.bz/docs/crypt/random#use-cases) -------------------------------------------------------------- * Generating session tokens * Creating random IVs for encryption * Generating salts for password hashing [Related Functions](https://docs.volt.bz/docs/crypt/random#related-functions) ------------------------------------------------------------------------------ * [`crypt.generatebytes`](https://docs.volt.bz/docs/crypt/generatebytes) - Alias for random bytes * [`crypt.generatekey`](https://docs.volt.bz/docs/crypt/generatekey) - Generate encryption key [crypt.hmac\ \ Previous Page](https://docs.volt.bz/docs/crypt/hmac) [Debug\ \ Next Page](https://docs.volt.bz/docs/debug) ### On this page [Syntax](https://docs.volt.bz/docs/crypt/random#syntax) [Parameters](https://docs.volt.bz/docs/crypt/random#parameters) [Returns](https://docs.volt.bz/docs/crypt/random#returns) [Description](https://docs.volt.bz/docs/crypt/random#description) [Example](https://docs.volt.bz/docs/crypt/random#example) [Use Cases](https://docs.volt.bz/docs/crypt/random#use-cases) [Related Functions](https://docs.volt.bz/docs/crypt/random#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) getsignalarguments ================== Gets the argument types for a signal. [Syntax](https://docs.volt.bz/docs/signals/getsignalarguments#syntax) ---------------------------------------------------------------------- getsignalarguments(signal: RBXScriptSignal) -> table [Parameters](https://docs.volt.bz/docs/signals/getsignalarguments#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal to check | [Returns](https://docs.volt.bz/docs/signals/getsignalarguments#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `table` | Array of argument type names | [Description](https://docs.volt.bz/docs/signals/getsignalarguments#description) -------------------------------------------------------------------------------- `getsignalarguments` returns information about the expected argument types for a signal. [Example](https://docs.volt.bz/docs/signals/getsignalarguments#example) ------------------------------------------------------------------------ local Players = game:GetService("Players") local args = getsignalarguments(Players.PlayerAdded) print("PlayerAdded expects:") for i, argType in ipairs(args) do print(i, argType) end [Related Functions](https://docs.volt.bz/docs/signals/getsignalarguments#related-functions) -------------------------------------------------------------------------------------------- * [`getsignalargumentsinfo`](https://docs.volt.bz/docs/signals/getsignalargumentsinfo) - Get detailed arg info * [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) - Fire a signal [getconnections\ \ Previous Page](https://docs.volt.bz/docs/signals/getconnections) [getsignalargumentsinfo\ \ Next Page](https://docs.volt.bz/docs/signals/getsignalargumentsinfo) ### On this page [Syntax](https://docs.volt.bz/docs/signals/getsignalarguments#syntax) [Parameters](https://docs.volt.bz/docs/signals/getsignalarguments#parameters) [Returns](https://docs.volt.bz/docs/signals/getsignalarguments#returns) [Description](https://docs.volt.bz/docs/signals/getsignalarguments#description) [Example](https://docs.volt.bz/docs/signals/getsignalarguments#example) [Related Functions](https://docs.volt.bz/docs/signals/getsignalarguments#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsolehide ============ Hides and destroys the console window. [Syntax](https://docs.volt.bz/docs/console/rconsolehide#syntax) ---------------------------------------------------------------- rconsolehide() -> void [Aliases](https://docs.volt.bz/docs/console/rconsolehide#aliases) ------------------------------------------------------------------ * `rconsoledestroy` * `consoledestroy` [Returns](https://docs.volt.bz/docs/console/rconsolehide#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsolehide#description) -------------------------------------------------------------------------- `rconsolehide` hides the console window and destroys it. All console output is cleared. [Example](https://docs.volt.bz/docs/console/rconsolehide#example) ------------------------------------------------------------------ -- Show console and print something rconsoleshow() rconsoleprint("This console will close in 5 seconds...\n") -- Wait and then hide task.wait(5) rconsolehide() [Notes](https://docs.volt.bz/docs/console/rconsolehide#notes) -------------------------------------------------------------- * All console content is lost when hidden * A new console can be created after hiding [Related Functions](https://docs.volt.bz/docs/console/rconsolehide#related-functions) -------------------------------------------------------------------------------------- * [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) - Show the console * [`rconsoletoggle`](https://docs.volt.bz/docs/console/rconsoletoggle) - Toggle console visibility [rconsolehidden\ \ Previous Page](https://docs.volt.bz/docs/console/rconsolehidden) [rconsoleinfo\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleinfo) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsolehide#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsolehide#aliases) [Returns](https://docs.volt.bz/docs/console/rconsolehide#returns) [Description](https://docs.volt.bz/docs/console/rconsolehide#description) [Example](https://docs.volt.bz/docs/console/rconsolehide#example) [Notes](https://docs.volt.bz/docs/console/rconsolehide#notes) [Related Functions](https://docs.volt.bz/docs/console/rconsolehide#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) hookmetamethod ============== Hooks a metamethod on an object's metatable. [Syntax](https://docs.volt.bz/docs/closures/hookmetamethod#syntax) ------------------------------------------------------------------- hookmetamethod(object: any, metamethod: string, hook: function) -> function [Parameters](https://docs.volt.bz/docs/closures/hookmetamethod#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `object` | `any` | An object with the target metatable | | `metamethod` | `string` | The metamethod name (e.g., "\*\*index", "\*\*namecall") | | `hook` | `function` | The replacement function | [Returns](https://docs.volt.bz/docs/closures/hookmetamethod#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `function` | A reference to the original metamethod | [Description](https://docs.volt.bz/docs/closures/hookmetamethod#description) ----------------------------------------------------------------------------- `hookmetamethod` replaces a metamethod in an object's metatable with your custom function. This is commonly used to intercept method calls, property accesses, and other metamethod operations on Roblox instances. [Example](https://docs.volt.bz/docs/closures/hookmetamethod#example) --------------------------------------------------------------------- -- Hook __namecall to intercept method calls local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local method = getnamecallmethod() if method == "GetService" then print("GetService called with:", ...) end return oldNamecall(self, ...) end)) -- This triggers the hook local players = game:GetService("Players") [Common Metamethods](https://docs.volt.bz/docs/closures/hookmetamethod#common-metamethods) ------------------------------------------------------------------------------------------- | Metamethod | Triggered By | | --- | --- | | `__index` | Property reads (`obj.Property`) | | `__newindex` | Property writes (`obj.Property = value`) | | `__namecall` | Method calls (`obj:Method()`) | | `__tostring` | `tostring(obj)` | | `__eq` | Equality comparison (`obj1 == obj2`) | [Notes](https://docs.volt.bz/docs/closures/hookmetamethod#notes) ----------------------------------------------------------------- * Automatically uses `newcclosure` when hooking metamethods on Roblox objects * Use `getnamecallmethod` inside `__namecall` hooks to get the method name * Multiple objects may share the same metatable * Use `checkcaller` to filter volt vs game calls [hookfunction\ \ Previous Page](https://docs.volt.bz/docs/closures/hookfunction) [iscclosure\ \ Next Page](https://docs.volt.bz/docs/closures/iscclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/hookmetamethod#syntax) [Parameters](https://docs.volt.bz/docs/closures/hookmetamethod#parameters) [Returns](https://docs.volt.bz/docs/closures/hookmetamethod#returns) [Description](https://docs.volt.bz/docs/closures/hookmetamethod#description) [Example](https://docs.volt.bz/docs/closures/hookmetamethod#example) [Common Metamethods](https://docs.volt.bz/docs/closures/hookmetamethod#common-metamethods) [Notes](https://docs.volt.bz/docs/closures/hookmetamethod#notes) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) run\_on\_actor ============== Runs a script on an actor's state. [Syntax](https://docs.volt.bz/docs/actors/run_on_actor#syntax) --------------------------------------------------------------- run_on_actor(actor: Actor, script: string, ...: any) -> void [Parameters](https://docs.volt.bz/docs/actors/run_on_actor#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `actor` | `Actor` | The actor to run the script on | | `script` | `string` | The Lua code to execute | | `...` | `any` | Arguments passed to the script | [Returns](https://docs.volt.bz/docs/actors/run_on_actor#returns) ----------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/actors/run_on_actor#description) ------------------------------------------------------------------------- `run_on_actor` executes the provided script string on the specified actor's Luau state. This allows you to run code in parallel on different threads. [Example](https://docs.volt.bz/docs/actors/run_on_actor#example) ----------------------------------------------------------------- local actor = Instance.new("Actor") actor.Parent = workspace run_on_actor(actor, [[\ print("Hello from actor!")\ print("Arguments:", ...)\ ]], "arg1", "arg2") [With Communication Channel](https://docs.volt.bz/docs/actors/run_on_actor#with-communication-channel) ------------------------------------------------------------------------------------------------------- local id, channel = create_comm_channel() channel.Event:Connect(function(message) print("Received:", message) end) run_on_actor(Instance.new("Actor"), [[\ local channelId = ...\ local channel = get_comm_channel(channelId)\ channel:Fire("Hello from actor!")\ ]], id) [Notes](https://docs.volt.bz/docs/actors/run_on_actor#notes) ------------------------------------------------------------- * The script runs in the actor's isolated environment * Use communication channels to send data back * Arguments are passed via varargs (`...`) [Related Functions](https://docs.volt.bz/docs/actors/run_on_actor#related-functions) ------------------------------------------------------------------------------------- * [`getactors`](https://docs.volt.bz/docs/actors/getactors) - Get all actors * [`create_comm_channel`](https://docs.volt.bz/docs/actors/create_comm_channel) - Create communication channel [on\_actor\_state\_created\ \ Previous Page](https://docs.volt.bz/docs/actors/on_actor_state_created) [Cache\ \ Next Page](https://docs.volt.bz/docs/cache) ### On this page [Syntax](https://docs.volt.bz/docs/actors/run_on_actor#syntax) [Parameters](https://docs.volt.bz/docs/actors/run_on_actor#parameters) [Returns](https://docs.volt.bz/docs/actors/run_on_actor#returns) [Description](https://docs.volt.bz/docs/actors/run_on_actor#description) [Example](https://docs.volt.bz/docs/actors/run_on_actor#example) [With Communication Channel](https://docs.volt.bz/docs/actors/run_on_actor#with-communication-channel) [Notes](https://docs.volt.bz/docs/actors/run_on_actor#notes) [Related Functions](https://docs.volt.bz/docs/actors/run_on_actor#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) getproperties ============= Gets all properties of an instance. [Syntax](https://docs.volt.bz/docs/reflection/getproperties#syntax) -------------------------------------------------------------------- getproperties(instance: Instance) -> table [Parameters](https://docs.volt.bz/docs/reflection/getproperties#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance to check | [Returns](https://docs.volt.bz/docs/reflection/getproperties#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Dictionary of all property values | [Description](https://docs.volt.bz/docs/reflection/getproperties#description) ------------------------------------------------------------------------------ `getproperties` returns a table containing all properties (both visible and hidden) and their current values for an instance. [Example](https://docs.volt.bz/docs/reflection/getproperties#example) ---------------------------------------------------------------------- local part = Instance.new("Part") local properties = getproperties(part) for property, value in pairs(properties) do print(property, "=", tostring(value)) end [Related Functions](https://docs.volt.bz/docs/reflection/getproperties#related-functions) ------------------------------------------------------------------------------------------ * [`gethiddenproperties`](https://docs.volt.bz/docs/reflection/gethiddenproperties) - Get hidden only * [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) - Get single hidden property [gethiddenproperty\ \ Previous Page](https://docs.volt.bz/docs/reflection/gethiddenproperty) [getthreadidentity\ \ Next Page](https://docs.volt.bz/docs/reflection/getthreadidentity) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/getproperties#syntax) [Parameters](https://docs.volt.bz/docs/reflection/getproperties#parameters) [Returns](https://docs.volt.bz/docs/reflection/getproperties#returns) [Description](https://docs.volt.bz/docs/reflection/getproperties#description) [Example](https://docs.volt.bz/docs/reflection/getproperties#example) [Related Functions](https://docs.volt.bz/docs/reflection/getproperties#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) getsignalargumentsinfo ====================== Gets detailed information about a signal's expected arguments. [Syntax](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#syntax) -------------------------------------------------------------------------- getsignalargumentsinfo(signal: RBXScriptSignal) -> table [Parameters](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#parameters) ---------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal to check | [Returns](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#returns) ---------------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of argument information entries | [Description](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#description) ------------------------------------------------------------------------------------ `getsignalargumentsinfo` returns detailed information about each argument a signal expects, including argument names and types. [Return Structure](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#return-structure) ---------------------------------------------------------------------------------------------- Each entry in the returned array contains: | Field | Type | Description | | --- | --- | --- | | `Type` | `string` | The type name of the argument | | `Name` | `string` | The parameter name | [Example](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#example) ---------------------------------------------------------------------------- local Players = game:GetService("Players") local argsInfo = getsignalargumentsinfo(Players.PlayerAdded) print("PlayerAdded arguments:") for i, arg in ipairs(argsInfo) do print(string.format(" %d. %s: %s", i, arg.Name, arg.Type)) end [Output Example](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#output-example) ------------------------------------------------------------------------------------------ PlayerAdded arguments: 1. player: Player [Use Cases](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#use-cases) -------------------------------------------------------------------------------- * Understanding signal argument structure * Building dynamic signal handlers * Debugging signal connections [Related Functions](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#related-functions) ------------------------------------------------------------------------------------------------ * [`getsignalarguments`](https://docs.volt.bz/docs/signals/getsignalarguments) - Get argument type names only * [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) - Fire a signal [getsignalarguments\ \ Previous Page](https://docs.volt.bz/docs/signals/getsignalarguments) [getsignalwhitelist\ \ Next Page](https://docs.volt.bz/docs/signals/getsignalwhitelist) ### On this page [Syntax](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#syntax) [Parameters](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#parameters) [Returns](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#returns) [Description](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#description) [Return Structure](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#return-structure) [Example](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#example) [Output Example](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#output-example) [Use Cases](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#use-cases) [Related Functions](https://docs.volt.bz/docs/signals/getsignalargumentsinfo#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) keypress ======== Simulates pressing a keyboard key. [Syntax](https://docs.volt.bz/docs/input/keypress#syntax) ---------------------------------------------------------- keypress(keycode: number) -> void [Aliases](https://docs.volt.bz/docs/input/keypress#aliases) ------------------------------------------------------------ * `keytap` [Parameters](https://docs.volt.bz/docs/input/keypress#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `keycode` | `number` | Virtual key code to press | [Returns](https://docs.volt.bz/docs/input/keypress#returns) ------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/input/keypress#description) -------------------------------------------------------------------- `keypress` simulates pressing a keyboard key down. The key stays pressed until `keyrelease` is called. [Common Key Codes](https://docs.volt.bz/docs/input/keypress#common-key-codes) ------------------------------------------------------------------------------ | Key | Code | | --- | --- | | Space | `0x20` | | Enter | `0x0D` | | Escape | `0x1B` | | Shift | `0x10` | | Control | `0x11` | | A-Z | `0x41-0x5A` | | 0-9 | `0x30-0x39` | [Example](https://docs.volt.bz/docs/input/keypress#example) ------------------------------------------------------------ -- Press and release the W key keypress(0x57) task.wait(0.5) keyrelease(0x57) [Notes](https://docs.volt.bz/docs/input/keypress#notes) -------------------------------------------------------- * Use Windows virtual key codes * Always release keys that you press * Check `iswindowactive()` before simulating input [Related Functions](https://docs.volt.bz/docs/input/keypress#related-functions) -------------------------------------------------------------------------------- * [`keyrelease`](https://docs.volt.bz/docs/input/keyrelease) - Release a key * [`keyclick`](https://docs.volt.bz/docs/input/keyclick) - Press and release [keyclick\ \ Previous Page](https://docs.volt.bz/docs/input/keyclick) [keyrelease\ \ Next Page](https://docs.volt.bz/docs/input/keyrelease) ### On this page [Syntax](https://docs.volt.bz/docs/input/keypress#syntax) [Aliases](https://docs.volt.bz/docs/input/keypress#aliases) [Parameters](https://docs.volt.bz/docs/input/keypress#parameters) [Returns](https://docs.volt.bz/docs/input/keypress#returns) [Description](https://docs.volt.bz/docs/input/keypress#description) [Common Key Codes](https://docs.volt.bz/docs/input/keypress#common-key-codes) [Example](https://docs.volt.bz/docs/input/keypress#example) [Notes](https://docs.volt.bz/docs/input/keypress#notes) [Related Functions](https://docs.volt.bz/docs/input/keypress#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) fireproximityprompt =================== Triggers a ProximityPrompt as if it was activated. [Syntax](https://docs.volt.bz/docs/instances/fireproximityprompt#syntax) ------------------------------------------------------------------------- fireproximityprompt(prompt: ProximityPrompt, amount?: number, skip?: boolean) -> void [Parameters](https://docs.volt.bz/docs/instances/fireproximityprompt#parameters) --------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `prompt` | `ProximityPrompt` | The ProximityPrompt to fire | | `amount` | `number?` | Number of times to trigger (default: 1) | | `skip` | `boolean?` | Skip the hold duration (default: true) | [Returns](https://docs.volt.bz/docs/instances/fireproximityprompt#returns) --------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/instances/fireproximityprompt#description) ----------------------------------------------------------------------------------- `fireproximityprompt` simulates activation of a ProximityPrompt, bypassing distance and hold time requirements. [Example](https://docs.volt.bz/docs/instances/fireproximityprompt#example) --------------------------------------------------------------------------- -- Find a ProximityPrompt local prompt = workspace.Door.ProximityPrompt -- Fire it once fireproximityprompt(prompt) -- Fire it 5 times fireproximityprompt(prompt, 5) -- Fire without skipping hold duration fireproximityprompt(prompt, 1, false) [Auto-Activate All Prompts](https://docs.volt.bz/docs/instances/fireproximityprompt#auto-activate-all-prompts) --------------------------------------------------------------------------------------------------------------- local function fireAllPrompts(parent) for _, desc in ipairs(parent:GetDescendants()) do if desc:IsA("ProximityPrompt") then fireproximityprompt(desc) end end end fireAllPrompts(workspace) [Notes](https://docs.volt.bz/docs/instances/fireproximityprompt#notes) ----------------------------------------------------------------------- * By default, the hold duration is skipped * The `amount` parameter is useful for prompts that need multiple activations [fireclickdetector\ \ Previous Page](https://docs.volt.bz/docs/instances/fireclickdetector) [firetouchinterest\ \ Next Page](https://docs.volt.bz/docs/instances/firetouchinterest) ### On this page [Syntax](https://docs.volt.bz/docs/instances/fireproximityprompt#syntax) [Parameters](https://docs.volt.bz/docs/instances/fireproximityprompt#parameters) [Returns](https://docs.volt.bz/docs/instances/fireproximityprompt#returns) [Description](https://docs.volt.bz/docs/instances/fireproximityprompt#description) [Example](https://docs.volt.bz/docs/instances/fireproximityprompt#example) [Auto-Activate All Prompts](https://docs.volt.bz/docs/instances/fireproximityprompt#auto-activate-all-prompts) [Notes](https://docs.volt.bz/docs/instances/fireproximityprompt#notes) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getloadedmodules ================ Returns all currently loaded ModuleScripts. [Syntax](https://docs.volt.bz/docs/scripts/getloadedmodules#syntax) -------------------------------------------------------------------- getloadedmodules() -> table [Returns](https://docs.volt.bz/docs/scripts/getloadedmodules#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of loaded ModuleScripts | [Description](https://docs.volt.bz/docs/scripts/getloadedmodules#description) ------------------------------------------------------------------------------ `getloadedmodules` returns a table of all ModuleScripts that have been required and loaded into memory. [Example](https://docs.volt.bz/docs/scripts/getloadedmodules#example) ---------------------------------------------------------------------- local modules = getloadedmodules() print("Loaded modules:", #modules) for _, module in ipairs(modules) do print("-", module:GetFullName()) end [Finding Specific Modules](https://docs.volt.bz/docs/scripts/getloadedmodules#finding-specific-modules) -------------------------------------------------------------------------------------------------------- local function findModule(name) for _, module in ipairs(getloadedmodules()) do if module.Name == name then return module end end return nil end local playerModule = findModule("PlayerModule") if playerModule then print("Found PlayerModule:", playerModule:GetFullName()) end [Accessing Module Environments](https://docs.volt.bz/docs/scripts/getloadedmodules#accessing-module-environments) ------------------------------------------------------------------------------------------------------------------ for _, module in ipairs(getloadedmodules()) do local env = getsenv(module) if env then print("Module:", module.Name) for key, value in pairs(env) do print(" ", key, type(value)) end end end [Related Functions](https://docs.volt.bz/docs/scripts/getloadedmodules#related-functions) ------------------------------------------------------------------------------------------ * [`getrunningscripts`](https://docs.volt.bz/docs/scripts/getrunningscripts) - Get running scripts * [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) - Get a script's environment [getcallingscript\ \ Previous Page](https://docs.volt.bz/docs/scripts/getcallingscript) [getmodules\ \ Next Page](https://docs.volt.bz/docs/scripts/getmodules) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getloadedmodules#syntax) [Returns](https://docs.volt.bz/docs/scripts/getloadedmodules#returns) [Description](https://docs.volt.bz/docs/scripts/getloadedmodules#description) [Example](https://docs.volt.bz/docs/scripts/getloadedmodules#example) [Finding Specific Modules](https://docs.volt.bz/docs/scripts/getloadedmodules#finding-specific-modules) [Accessing Module Environments](https://docs.volt.bz/docs/scripts/getloadedmodules#accessing-module-environments) [Related Functions](https://docs.volt.bz/docs/scripts/getloadedmodules#related-functions) --- # Volt Documentation [Actors](https://docs.volt.bz/docs/actors) on\_actor\_state\_created ========================= Event fired when an Actor Lua state is created, before any scripts are executed. [Syntax](https://docs.volt.bz/docs/actors/on_actor_state_created#syntax) ------------------------------------------------------------------------- on_actor_state_created: BindableEvent [Description](https://docs.volt.bz/docs/actors/on_actor_state_created#description) ----------------------------------------------------------------------------------- `on_actor_state_created` is a global BindableEvent that fires when a new Actor Lua state is created, before any scripts are executed on that state. This allows you to set up hooks or inject code into new actor states as they're created. [Event Arguments](https://docs.volt.bz/docs/actors/on_actor_state_created#event-arguments) ------------------------------------------------------------------------------------------- | Argument | Type | Description | | --- | --- | --- | | `actor` | `Actor` | The Actor instance whose state was created | [Example](https://docs.volt.bz/docs/actors/on_actor_state_created#example) --------------------------------------------------------------------------- on_actor_state_created.Event:Connect(function(actor) print("New actor state created:", actor:GetFullName()) -- Get the state for this actor local state = getluastate(actor) print("State ID:", state.Id) end) [Setup Hooks on New States](https://docs.volt.bz/docs/actors/on_actor_state_created#setup-hooks-on-new-states) --------------------------------------------------------------------------------------------------------------- on_actor_state_created.Event:Connect(function(actor) local state = getluastate(actor) -- Execute setup code on the new state state:Execute([[\ -- This runs before any scripts execute on the actor\ print("Actor state initialized!")\ ]]) end) [With Communication Channel](https://docs.volt.bz/docs/actors/on_actor_state_created#with-communication-channel) ----------------------------------------------------------------------------------------------------------------- local id, channel = create_comm_channel() channel.Event:Connect(function(actorName) print("Actor state ready:", actorName) end) on_actor_state_created.Event:Connect(function(actor) local state = getluastate(actor) state:Execute([[\ local channelId = ...\ local channel = get_comm_channel(channelId)\ channel:Fire(script:GetFullName())\ ]], id) end) [Notes](https://docs.volt.bz/docs/actors/on_actor_state_created#notes) ----------------------------------------------------------------------- * Fires before any scripts execute on the actor state * Useful for setting up hooks or injecting code early * The state is fully initialized but empty when this fires [Related Functions](https://docs.volt.bz/docs/actors/on_actor_state_created#related-functions) ----------------------------------------------------------------------------------------------- * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get LuaStateProxy for an actor * [`on_actor_added`](https://docs.volt.bz/docs/actors/on_actor_added) - Event fired when actor is ready (after scripts load) * [`getactorstates`](https://docs.volt.bz/docs/actors/getactorstates) - Get all active LuaStateProxy objects [on\_actor\_added\ \ Previous Page](https://docs.volt.bz/docs/actors/on_actor_added) [run\_on\_actor\ \ Next Page](https://docs.volt.bz/docs/actors/run_on_actor) ### On this page [Syntax](https://docs.volt.bz/docs/actors/on_actor_state_created#syntax) [Description](https://docs.volt.bz/docs/actors/on_actor_state_created#description) [Event Arguments](https://docs.volt.bz/docs/actors/on_actor_state_created#event-arguments) [Example](https://docs.volt.bz/docs/actors/on_actor_state_created#example) [Setup Hooks on New States](https://docs.volt.bz/docs/actors/on_actor_state_created#setup-hooks-on-new-states) [With Communication Channel](https://docs.volt.bz/docs/actors/on_actor_state_created#with-communication-channel) [Notes](https://docs.volt.bz/docs/actors/on_actor_state_created#notes) [Related Functions](https://docs.volt.bz/docs/actors/on_actor_state_created#related-functions) --- # Volt Documentation [LuaStateProxy](https://docs.volt.bz/docs/luastateproxy) LuaStateProxy.new ================= Constructs a new LuaStateProxy based on the current Lua state. [Syntax](https://docs.volt.bz/docs/luastateproxy/new#syntax) ------------------------------------------------------------- LuaStateProxy.new() -> LuaStateProxy [Parameters](https://docs.volt.bz/docs/luastateproxy/new#parameters) --------------------------------------------------------------------- This function takes no parameters. [Returns](https://docs.volt.bz/docs/luastateproxy/new#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `LuaStateProxy` | A new LuaStateProxy for the current state | [Description](https://docs.volt.bz/docs/luastateproxy/new#description) ----------------------------------------------------------------------- `LuaStateProxy.new` creates a new `LuaStateProxy` instance representing the current Lua execution state. This allows you to access state properties and execute code on the current state. [Example](https://docs.volt.bz/docs/luastateproxy/new#example) --------------------------------------------------------------- -- Create a proxy for the current state local state = LuaStateProxy.new() print("State ID:", state.Id) print("Is Actor State:", state.IsActorState) [Get Current State](https://docs.volt.bz/docs/luastateproxy/new#get-current-state) ----------------------------------------------------------------------------------- local state = LuaStateProxy.new() -- Access state properties print("State ID:", state.Id) -- Execute code on this state state:Execute([[\ print("Executed on current state!")\ ]]) [Related Functions](https://docs.volt.bz/docs/luastateproxy/new#related-functions) ----------------------------------------------------------------------------------- * [`getluastate`](https://docs.volt.bz/docs/actors/getluastate) - Get LuaStateProxy for an actor or script * [`getgamestate`](https://docs.volt.bz/docs/actors/getgamestate) - Get the default game Lua state * [`LuaStateProxy:Execute`](https://docs.volt.bz/docs/luastateproxy/execute) - Execute code on the state [LuaStateProxy.IsActorState\ \ Previous Page](https://docs.volt.bz/docs/luastateproxy/isactorstate) [Metatable\ \ Next Page](https://docs.volt.bz/docs/metatable) ### On this page [Syntax](https://docs.volt.bz/docs/luastateproxy/new#syntax) [Parameters](https://docs.volt.bz/docs/luastateproxy/new#parameters) [Returns](https://docs.volt.bz/docs/luastateproxy/new#returns) [Description](https://docs.volt.bz/docs/luastateproxy/new#description) [Example](https://docs.volt.bz/docs/luastateproxy/new#example) [Get Current State](https://docs.volt.bz/docs/luastateproxy/new#get-current-state) [Related Functions](https://docs.volt.bz/docs/luastateproxy/new#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) getfflag ======== Gets a Roblox Fast Flag value. [Syntax](https://docs.volt.bz/docs/miscellaneous/getfflag#syntax) ------------------------------------------------------------------ getfflag(name: string) -> string [Parameters](https://docs.volt.bz/docs/miscellaneous/getfflag#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `name` | `string` | The flag name | [Returns](https://docs.volt.bz/docs/miscellaneous/getfflag#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The flag value | [Description](https://docs.volt.bz/docs/miscellaneous/getfflag#description) ---------------------------------------------------------------------------- `getfflag` retrieves the current value of a Roblox Fast Flag. [Example](https://docs.volt.bz/docs/miscellaneous/getfflag#example) -------------------------------------------------------------------- -- Get current target FPS local fps = getfflag("DFIntTaskSchedulerTargetFps") print("Target FPS:", fps) -- Check if a feature is enabled local enabled = getfflag("FFlagSomeFeature") print("Feature enabled:", enabled == "true") [Related Functions](https://docs.volt.bz/docs/miscellaneous/getfflag#related-functions) ---------------------------------------------------------------------------------------- * [`setfflag`](https://docs.volt.bz/docs/miscellaneous/setfflag) - Set flag value [clearqueueonteleport\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport) [getfpscap\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/getfpscap) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/getfflag#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/getfflag#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/getfflag#returns) [Description](https://docs.volt.bz/docs/miscellaneous/getfflag#description) [Example](https://docs.volt.bz/docs/miscellaneous/getfflag#example) [Related Functions](https://docs.volt.bz/docs/miscellaneous/getfflag#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) dofile ====== Loads and executes a Lua file. [Syntax](https://docs.volt.bz/docs/filesystem/dofile#syntax) ------------------------------------------------------------- dofile(path: string) -> any... [Aliases](https://docs.volt.bz/docs/filesystem/dofile#aliases) --------------------------------------------------------------- * `runfile` [Parameters](https://docs.volt.bz/docs/filesystem/dofile#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | Path to the Lua file | [Returns](https://docs.volt.bz/docs/filesystem/dofile#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `any...` | Values returned by the executed file | [Description](https://docs.volt.bz/docs/filesystem/dofile#description) ----------------------------------------------------------------------- `dofile` reads a Lua file from the workspace folder, compiles it, and executes it. Any values returned by the file are returned by `dofile`. [Example](https://docs.volt.bz/docs/filesystem/dofile#example) --------------------------------------------------------------- -- Create a script file writefile("mymodule.lua", [[\ local module = {}\ module.greeting = "Hello!"\ return module\ ]]) -- Execute and get the return value local myModule = dofile("mymodule.lua") print(myModule.greeting) -- "Hello!" [Execute Script](https://docs.volt.bz/docs/filesystem/dofile#execute-script) ----------------------------------------------------------------------------- -- Create and run a script writefile("script.lua", [[\ print("Script executed!")\ for i = 1, 5 do\ print("Count:", i)\ end\ ]]) dofile("script.lua") [Notes](https://docs.volt.bz/docs/filesystem/dofile#notes) ----------------------------------------------------------- * This is a yielding function * File must be valid Lua/Luau code * Errors in the file will propagate [Related Functions](https://docs.volt.bz/docs/filesystem/dofile#related-functions) ----------------------------------------------------------------------------------- * [`loadfile`](https://docs.volt.bz/docs/filesystem/loadfile) - Load without executing * [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) - Read file as string [delfolder\ \ Previous Page](https://docs.volt.bz/docs/filesystem/delfolder) [getcustomasset\ \ Next Page](https://docs.volt.bz/docs/filesystem/getcustomasset) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/dofile#syntax) [Aliases](https://docs.volt.bz/docs/filesystem/dofile#aliases) [Parameters](https://docs.volt.bz/docs/filesystem/dofile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/dofile#returns) [Description](https://docs.volt.bz/docs/filesystem/dofile#description) [Example](https://docs.volt.bz/docs/filesystem/dofile#example) [Execute Script](https://docs.volt.bz/docs/filesystem/dofile#execute-script) [Notes](https://docs.volt.bz/docs/filesystem/dofile#notes) [Related Functions](https://docs.volt.bz/docs/filesystem/dofile#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getinfo ============= Gets information about a function or stack level. [Syntax](https://docs.volt.bz/docs/debug/getinfo#syntax) --------------------------------------------------------- debug.getinfo(func_or_level: function | number, what: string?) -> table [Parameters](https://docs.volt.bz/docs/debug/getinfo#parameters) ----------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func_or_level` | `function/number` | Function or stack level | | `what` | `string` | (Optional) What info to return | [Returns](https://docs.volt.bz/docs/debug/getinfo#returns) ----------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Information about target | [Description](https://docs.volt.bz/docs/debug/getinfo#description) ------------------------------------------------------------------- `debug.getinfo` returns a table with information about a function or the function at a given stack level. [Info Fields](https://docs.volt.bz/docs/debug/getinfo#info-fields) ------------------------------------------------------------------- | Field | What | Description | | --- | --- | --- | | `name` | `n` | Function name | | `source` | `S` | Source identifier | | `short_src` | `S` | Short source name | | `what` | `S` | "Lua", "C", or "main" | | `currentline` | `l` | Current line | | `linedefined` | `S` | Line where definition starts | | `lastlinedefined` | `S` | Line where definition ends | | `nups` | `u` | Number of upvalues | | `nparams` | `u` | Number of parameters | | `func` | `f` | The function itself | [Example](https://docs.volt.bz/docs/debug/getinfo#example) ----------------------------------------------------------- local function myFunc() return "hello" end local info = debug.getinfo(myFunc) print("Name:", info.name) print("Source:", info.short_src) print("Line defined:", info.linedefined) -- Get info for current function local currentInfo = debug.getinfo(1) print("Current function:", currentInfo.name) [Related Functions](https://docs.volt.bz/docs/debug/getinfo#related-functions) ------------------------------------------------------------------------------- * [`debug.getcallstack`](https://docs.volt.bz/docs/debug/getcallstack) - Get full call stack * [`debug.validlevel`](https://docs.volt.bz/docs/debug/validlevel) - Check if level is valid [debug.getconstants\ \ Previous Page](https://docs.volt.bz/docs/debug/getconstants) [debug.getproto\ \ Next Page](https://docs.volt.bz/docs/debug/getproto) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getinfo#syntax) [Parameters](https://docs.volt.bz/docs/debug/getinfo#parameters) [Returns](https://docs.volt.bz/docs/debug/getinfo#returns) [Description](https://docs.volt.bz/docs/debug/getinfo#description) [Info Fields](https://docs.volt.bz/docs/debug/getinfo#info-fields) [Example](https://docs.volt.bz/docs/debug/getinfo#example) [Related Functions](https://docs.volt.bz/docs/debug/getinfo#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleinfo ============ Prints an info message to the console. [Syntax](https://docs.volt.bz/docs/console/rconsoleinfo#syntax) ---------------------------------------------------------------- rconsoleinfo(text: string) -> void [Parameters](https://docs.volt.bz/docs/console/rconsoleinfo#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The info message | [Returns](https://docs.volt.bz/docs/console/rconsoleinfo#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoleinfo#description) -------------------------------------------------------------------------- `rconsoleinfo` prints an info-level message to the console, typically with a distinct color or prefix to indicate it's informational. [Example](https://docs.volt.bz/docs/console/rconsoleinfo#example) ------------------------------------------------------------------ rconsoleshow() rconsoleinfo("Script loaded successfully") rconsoleinfo("Found 5 players in game") [Related Functions](https://docs.volt.bz/docs/console/rconsoleinfo#related-functions) -------------------------------------------------------------------------------------- * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print plain text * [`rconsolewarn`](https://docs.volt.bz/docs/console/rconsolewarn) - Print warning * [`rconsoleerr`](https://docs.volt.bz/docs/console/rconsoleerr) - Print error [rconsolehide\ \ Previous Page](https://docs.volt.bz/docs/console/rconsolehide) [rconsoleinput\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleinput) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleinfo#syntax) [Parameters](https://docs.volt.bz/docs/console/rconsoleinfo#parameters) [Returns](https://docs.volt.bz/docs/console/rconsoleinfo#returns) [Description](https://docs.volt.bz/docs/console/rconsoleinfo#description) [Example](https://docs.volt.bz/docs/console/rconsoleinfo#example) [Related Functions](https://docs.volt.bz/docs/console/rconsoleinfo#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) iscclosure ========== Checks if a function is a C closure. [Syntax](https://docs.volt.bz/docs/closures/iscclosure#syntax) --------------------------------------------------------------- iscclosure(func: function) -> boolean [Parameters](https://docs.volt.bz/docs/closures/iscclosure#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to check | [Returns](https://docs.volt.bz/docs/closures/iscclosure#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the function is a C closure, `false` otherwise | [Description](https://docs.volt.bz/docs/closures/iscclosure#description) ------------------------------------------------------------------------- `iscclosure` returns whether the given function is implemented in C/C++ rather than Luau. C closures include built-in Lua functions, Roblox API methods, and functions wrapped with `newcclosure`. [Example](https://docs.volt.bz/docs/closures/iscclosure#example) ----------------------------------------------------------------- -- Built-in functions are C closures print(iscclosure(print)) -- true print(iscclosure(type)) -- true print(iscclosure(game.GetService)) -- true -- User-defined functions are Luau closures local function myFunc() return "hello" end print(iscclosure(myFunc)) -- false -- Wrapped functions become C closures local wrapped = newcclosure(myFunc) print(iscclosure(wrapped)) -- true [Related Functions](https://docs.volt.bz/docs/closures/iscclosure#related-functions) ------------------------------------------------------------------------------------- * [`islclosure`](https://docs.volt.bz/docs/closures/islclosure) - Check if a function is a Luau closure * [`newcclosure`](https://docs.volt.bz/docs/closures/newcclosure) - Wrap a Luau function as a C closure [hookmetamethod\ \ Previous Page](https://docs.volt.bz/docs/closures/hookmetamethod) [isexecutorclosure\ \ Next Page](https://docs.volt.bz/docs/closures/isexecutorclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/iscclosure#syntax) [Parameters](https://docs.volt.bz/docs/closures/iscclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/iscclosure#returns) [Description](https://docs.volt.bz/docs/closures/iscclosure#description) [Example](https://docs.volt.bz/docs/closures/iscclosure#example) [Related Functions](https://docs.volt.bz/docs/closures/iscclosure#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) makereadonly ============ Makes a table read-only. [Syntax](https://docs.volt.bz/docs/metatable/makereadonly#syntax) ------------------------------------------------------------------ makereadonly(table: table) -> void [Parameters](https://docs.volt.bz/docs/metatable/makereadonly#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `table` | `table` | The table to make read-only | [Returns](https://docs.volt.bz/docs/metatable/makereadonly#returns) -------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/metatable/makereadonly#description) ---------------------------------------------------------------------------- `makereadonly` sets a table's read-only flag to true, preventing modifications. [Example](https://docs.volt.bz/docs/metatable/makereadonly#example) -------------------------------------------------------------------- local myTable = {value = 123} makereadonly(myTable) -- This will error myTable.value = 456 -- Cannot modify read-only table [Notes](https://docs.volt.bz/docs/metatable/makereadonly#notes) ---------------------------------------------------------------- * Equivalent to `setreadonly(table, true)` * Use `makewritable` to reverse [Related Functions](https://docs.volt.bz/docs/metatable/makereadonly#related-functions) ---------------------------------------------------------------------------------------- * [`makewritable`](https://docs.volt.bz/docs/metatable/makewritable) - Make table writable * [`setreadonly`](https://docs.volt.bz/docs/metatable/setreadonly) - Set read-only status * [`isreadonly`](https://docs.volt.bz/docs/metatable/isreadonly) - Check read-only status [iswritable\ \ Previous Page](https://docs.volt.bz/docs/metatable/iswritable) [makewritable\ \ Next Page](https://docs.volt.bz/docs/metatable/makewritable) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/makereadonly#syntax) [Parameters](https://docs.volt.bz/docs/metatable/makereadonly#parameters) [Returns](https://docs.volt.bz/docs/metatable/makereadonly#returns) [Description](https://docs.volt.bz/docs/metatable/makereadonly#description) [Example](https://docs.volt.bz/docs/metatable/makereadonly#example) [Notes](https://docs.volt.bz/docs/metatable/makereadonly#notes) [Related Functions](https://docs.volt.bz/docs/metatable/makereadonly#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) makewritable ============ Makes a table writable. [Syntax](https://docs.volt.bz/docs/metatable/makewritable#syntax) ------------------------------------------------------------------ makewritable(table: table) -> void [Parameters](https://docs.volt.bz/docs/metatable/makewritable#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `table` | `table` | The table to make writable | [Returns](https://docs.volt.bz/docs/metatable/makewritable#returns) -------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/metatable/makewritable#description) ---------------------------------------------------------------------------- `makewritable` removes the read-only flag from a table, allowing modifications. [Example](https://docs.volt.bz/docs/metatable/makewritable#example) -------------------------------------------------------------------- local mt = getrawmetatable(game) -- Make writable for modifications makewritable(mt) -- Now we can modify it local oldIndex = mt.__index mt.__index = newcclosure(function(self, key) return oldIndex(self, key) end) -- Lock it again makereadonly(mt) [Notes](https://docs.volt.bz/docs/metatable/makewritable#notes) ---------------------------------------------------------------- * Equivalent to `setreadonly(table, false)` * Always re-lock metatables after modification [Related Functions](https://docs.volt.bz/docs/metatable/makewritable#related-functions) ---------------------------------------------------------------------------------------- * [`makereadonly`](https://docs.volt.bz/docs/metatable/makereadonly) - Make table read-only * [`setreadonly`](https://docs.volt.bz/docs/metatable/setreadonly) - Set read-only status * [`isreadonly`](https://docs.volt.bz/docs/metatable/isreadonly) - Check read-only status [makereadonly\ \ Previous Page](https://docs.volt.bz/docs/metatable/makereadonly) [setnamecallmethod\ \ Next Page](https://docs.volt.bz/docs/metatable/setnamecallmethod) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/makewritable#syntax) [Parameters](https://docs.volt.bz/docs/metatable/makewritable#parameters) [Returns](https://docs.volt.bz/docs/metatable/makewritable#returns) [Description](https://docs.volt.bz/docs/metatable/makewritable#description) [Example](https://docs.volt.bz/docs/metatable/makewritable#example) [Notes](https://docs.volt.bz/docs/metatable/makewritable#notes) [Related Functions](https://docs.volt.bz/docs/metatable/makewritable#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) getsignalwhitelist ================== Gets the list of signals in the network whitelist filter. [Syntax](https://docs.volt.bz/docs/signals/getsignalwhitelist#syntax) ---------------------------------------------------------------------- getsignalwhitelist() -> table [Returns](https://docs.volt.bz/docs/signals/getsignalwhitelist#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `table` | Array of whitelisted signal information | [Description](https://docs.volt.bz/docs/signals/getsignalwhitelist#description) -------------------------------------------------------------------------------- `getsignalwhitelist` returns information about signals that are in Roblox's strict network filter whitelist. These are signals that are allowed to replicate to the server. [Return Structure](https://docs.volt.bz/docs/signals/getsignalwhitelist#return-structure) ------------------------------------------------------------------------------------------ Each entry in the returned array contains: | Field | Type | Description | | --- | --- | --- | | `Event` | `string` | The name of the event/signal | | `Parent` | `string` | The class that owns the signal | [Example](https://docs.volt.bz/docs/signals/getsignalwhitelist#example) ------------------------------------------------------------------------ local whitelist = getsignalwhitelist() for i, entry in ipairs(whitelist) do print(string.format("%s.%s", entry.Parent, entry.Event)) end [Use Cases](https://docs.volt.bz/docs/signals/getsignalwhitelist#use-cases) ---------------------------------------------------------------------------- * Determining which signals can be replicated * Understanding network security boundaries * Debugging replication issues [Related Functions](https://docs.volt.bz/docs/signals/getsignalwhitelist#related-functions) -------------------------------------------------------------------------------------------- * [`replicatesignal`](https://docs.volt.bz/docs/signals/replicatesignal) - Fire with replication * [`cansignalreplicate`](https://docs.volt.bz/docs/signals/cansignalreplicate) - Check if signal can replicate [getsignalargumentsinfo\ \ Previous Page](https://docs.volt.bz/docs/signals/getsignalargumentsinfo) [replicatesignal\ \ Next Page](https://docs.volt.bz/docs/signals/replicatesignal) ### On this page [Syntax](https://docs.volt.bz/docs/signals/getsignalwhitelist#syntax) [Returns](https://docs.volt.bz/docs/signals/getsignalwhitelist#returns) [Description](https://docs.volt.bz/docs/signals/getsignalwhitelist#description) [Return Structure](https://docs.volt.bz/docs/signals/getsignalwhitelist#return-structure) [Example](https://docs.volt.bz/docs/signals/getsignalwhitelist#example) [Use Cases](https://docs.volt.bz/docs/signals/getsignalwhitelist#use-cases) [Related Functions](https://docs.volt.bz/docs/signals/getsignalwhitelist#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) getcustomasset ============== Returns a content URL for a local file that can be used in Roblox. [Syntax](https://docs.volt.bz/docs/filesystem/getcustomasset#syntax) --------------------------------------------------------------------- getcustomasset(path: string) -> string [Parameters](https://docs.volt.bz/docs/filesystem/getcustomasset#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path | [Returns](https://docs.volt.bz/docs/filesystem/getcustomasset#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | A content URL usable in Roblox | [Description](https://docs.volt.bz/docs/filesystem/getcustomasset#description) ------------------------------------------------------------------------------- `getcustomasset` converts a local file into a content URL that Roblox can use for images, sounds, and other assets. [Example: Custom Image](https://docs.volt.bz/docs/filesystem/getcustomasset#example-custom-image) -------------------------------------------------------------------------------------------------- -- Save an image to the workspace -- (assume image data is obtained somehow) writefile("myimage.png", imageData) -- Get a usable URL local imageUrl = getcustomasset("myimage.png") -- Use it in a GUI local imageLabel = Instance.new("ImageLabel") imageLabel.Image = imageUrl imageLabel.Parent = someGui [Example: Custom Sound](https://docs.volt.bz/docs/filesystem/getcustomasset#example-custom-sound) -------------------------------------------------------------------------------------------------- -- Get URL for a local sound file local soundUrl = getcustomasset("mysound.mp3") -- Create and play the sound local sound = Instance.new("Sound") sound.SoundId = soundUrl sound.Parent = workspace sound:Play() [Supported Formats](https://docs.volt.bz/docs/filesystem/getcustomasset#supported-formats) ------------------------------------------------------------------------------------------- | Type | Formats | | --- | --- | | Images | PNG, JPG, JPEG | | Audio | MP3, OGG, WAV | [Notes](https://docs.volt.bz/docs/filesystem/getcustomasset#notes) ------------------------------------------------------------------- * The file must exist in the workspace folder * The returned URL is only valid for the current session * Large files may take time to load [Aliases](https://docs.volt.bz/docs/filesystem/getcustomasset#aliases) ----------------------------------------------------------------------- * `getsynasset` [dofile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/dofile) [isfile\ \ Next Page](https://docs.volt.bz/docs/filesystem/isfile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/getcustomasset#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/getcustomasset#parameters) [Returns](https://docs.volt.bz/docs/filesystem/getcustomasset#returns) [Description](https://docs.volt.bz/docs/filesystem/getcustomasset#description) [Example: Custom Image](https://docs.volt.bz/docs/filesystem/getcustomasset#example-custom-image) [Example: Custom Sound](https://docs.volt.bz/docs/filesystem/getcustomasset#example-custom-sound) [Supported Formats](https://docs.volt.bz/docs/filesystem/getcustomasset#supported-formats) [Notes](https://docs.volt.bz/docs/filesystem/getcustomasset#notes) [Aliases](https://docs.volt.bz/docs/filesystem/getcustomasset#aliases) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleinput ============= Gets input from the user via the console. [Syntax](https://docs.volt.bz/docs/console/rconsoleinput#syntax) ----------------------------------------------------------------- rconsoleinput() -> string [Aliases](https://docs.volt.bz/docs/console/rconsoleinput#aliases) ------------------------------------------------------------------- * `consoleinput` [Returns](https://docs.volt.bz/docs/console/rconsoleinput#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The user's input | [Description](https://docs.volt.bz/docs/console/rconsoleinput#description) --------------------------------------------------------------------------- `rconsoleinput` waits for the user to type something in the console and press Enter, then returns the input as a string. This is a yielding function. [Example](https://docs.volt.bz/docs/console/rconsoleinput#example) ------------------------------------------------------------------- rconsoleshow() rconsoleprint("What is your name? ") local name = rconsoleinput() rconsoleprint("Hello, " .. name .. "!\n") [Interactive Menu Example](https://docs.volt.bz/docs/console/rconsoleinput#interactive-menu-example) ----------------------------------------------------------------------------------------------------- rconsoleshow() rconsolename("Script Menu") rconsoleprint("Select an option:\n") rconsoleprint("1. Option A\n") rconsoleprint("2. Option B\n") rconsoleprint("3. Exit\n\n") rconsoleprint("Enter choice: ") local choice = rconsoleinput() if choice == "1" then rconsoleprint("You selected Option A\n") elseif choice == "2" then rconsoleprint("You selected Option B\n") else rconsoleprint("Goodbye!\n") task.wait(1) rconsolehide() end [Notes](https://docs.volt.bz/docs/console/rconsoleinput#notes) --------------------------------------------------------------- * This function yields until the user presses Enter * Returns an empty string if the console is closed [Related Functions](https://docs.volt.bz/docs/console/rconsoleinput#related-functions) --------------------------------------------------------------------------------------- * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print to console [rconsoleinfo\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleinfo) [rconsolename\ \ Next Page](https://docs.volt.bz/docs/console/rconsolename) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleinput#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsoleinput#aliases) [Returns](https://docs.volt.bz/docs/console/rconsoleinput#returns) [Description](https://docs.volt.bz/docs/console/rconsoleinput#description) [Example](https://docs.volt.bz/docs/console/rconsoleinput#example) [Interactive Menu Example](https://docs.volt.bz/docs/console/rconsoleinput#interactive-menu-example) [Notes](https://docs.volt.bz/docs/console/rconsoleinput#notes) [Related Functions](https://docs.volt.bz/docs/console/rconsoleinput#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) getthreadidentity ================= Gets the current thread's identity level. [Syntax](https://docs.volt.bz/docs/reflection/getthreadidentity#syntax) ------------------------------------------------------------------------ getthreadidentity() -> number [Returns](https://docs.volt.bz/docs/reflection/getthreadidentity#returns) -------------------------------------------------------------------------- | Type | Description | | --- | --- | | `number` | The current identity level | [Description](https://docs.volt.bz/docs/reflection/getthreadidentity#description) ---------------------------------------------------------------------------------- `getthreadidentity` returns the identity level of the current thread. Higher identity levels have access to more restricted APIs. [Example](https://docs.volt.bz/docs/reflection/getthreadidentity#example) -------------------------------------------------------------------------- local identity = getthreadidentity() print("Current identity:", identity) [Related Functions](https://docs.volt.bz/docs/reflection/getthreadidentity#related-functions) ---------------------------------------------------------------------------------------------- * [`setthreadidentity`](https://docs.volt.bz/docs/reflection/setthreadidentity) - Set the identity level [Aliases](https://docs.volt.bz/docs/reflection/getthreadidentity#aliases) -------------------------------------------------------------------------- * `getidentity` * `getthreadcontext` [getproperties\ \ Previous Page](https://docs.volt.bz/docs/reflection/getproperties) [isnetworkowner\ \ Next Page](https://docs.volt.bz/docs/reflection/isnetworkowner) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/getthreadidentity#syntax) [Returns](https://docs.volt.bz/docs/reflection/getthreadidentity#returns) [Description](https://docs.volt.bz/docs/reflection/getthreadidentity#description) [Example](https://docs.volt.bz/docs/reflection/getthreadidentity#example) [Related Functions](https://docs.volt.bz/docs/reflection/getthreadidentity#related-functions) [Aliases](https://docs.volt.bz/docs/reflection/getthreadidentity#aliases) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) isnetworkowner ============== Checks if the local player owns a part's physics simulation. [Syntax](https://docs.volt.bz/docs/reflection/isnetworkowner#syntax) --------------------------------------------------------------------- isnetworkowner(part: BasePart) -> boolean [Parameters](https://docs.volt.bz/docs/reflection/isnetworkowner#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `part` | `BasePart` | The part to check | [Returns](https://docs.volt.bz/docs/reflection/isnetworkowner#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if local player is network owner | [Description](https://docs.volt.bz/docs/reflection/isnetworkowner#description) ------------------------------------------------------------------------------- `isnetworkowner` checks whether the local client has network ownership of a part, meaning they control its physics simulation. [Example](https://docs.volt.bz/docs/reflection/isnetworkowner#example) ----------------------------------------------------------------------- local part = workspace.Part if isnetworkowner(part) then print("You own this part's physics") -- Can manipulate physics reliably part.Velocity = Vector3.new(0, 50, 0) else print("Server or another player owns this part") end [Notes](https://docs.volt.bz/docs/reflection/isnetworkowner#notes) ------------------------------------------------------------------- * Network ownership affects physics simulation authority * Use `setsimulationradius` to expand ownership range [Related Functions](https://docs.volt.bz/docs/reflection/isnetworkowner#related-functions) ------------------------------------------------------------------------------------------- * [`setsimulationradius`](https://docs.volt.bz/docs/reflection/setsimulationradius) - Set simulation radius [getthreadidentity\ \ Previous Page](https://docs.volt.bz/docs/reflection/getthreadidentity) [isscriptable\ \ Next Page](https://docs.volt.bz/docs/reflection/isscriptable) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/isnetworkowner#syntax) [Parameters](https://docs.volt.bz/docs/reflection/isnetworkowner#parameters) [Returns](https://docs.volt.bz/docs/reflection/isnetworkowner#returns) [Description](https://docs.volt.bz/docs/reflection/isnetworkowner#description) [Example](https://docs.volt.bz/docs/reflection/isnetworkowner#example) [Notes](https://docs.volt.bz/docs/reflection/isnetworkowner#notes) [Related Functions](https://docs.volt.bz/docs/reflection/isnetworkowner#related-functions) --- # Volt Documentation [Signals](https://docs.volt.bz/docs/signals) replicatesignal =============== Fires a signal with server replication. [Syntax](https://docs.volt.bz/docs/signals/replicatesignal#syntax) ------------------------------------------------------------------- replicatesignal(signal: RBXScriptSignal, ...: any) -> void [Parameters](https://docs.volt.bz/docs/signals/replicatesignal#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `signal` | `RBXScriptSignal` | The signal to fire | | `...` | `any` | Arguments to pass | [Returns](https://docs.volt.bz/docs/signals/replicatesignal#returns) --------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/signals/replicatesignal#description) ----------------------------------------------------------------------------- `replicatesignal` fires a signal in a way that replicates to the server, unlike `firesignal` which only fires locally. [Example](https://docs.volt.bz/docs/signals/replicatesignal#example) --------------------------------------------------------------------- -- Fire a ProximityPrompt's Triggered signal with replication local prompt = workspace.Door.ProximityPrompt replicatesignal(prompt.Triggered, game.Players.LocalPlayer) [Difference from firesignal](https://docs.volt.bz/docs/signals/replicatesignal#difference-from-firesignal) ----------------------------------------------------------------------------------------------------------- | Function | Local | Replicates | | --- | --- | --- | | `firesignal` | ✅ | ❌ | | `replicatesignal` | ✅ | ✅ | [Use Cases](https://docs.volt.bz/docs/signals/replicatesignal#use-cases) ------------------------------------------------------------------------- * **Input simulation**: Simulate user input that needs server acknowledgment * **Interaction triggers**: Fire interaction events that should replicate * **Testing**: Test server-replicated behavior [Notes](https://docs.volt.bz/docs/signals/replicatesignal#notes) ----------------------------------------------------------------- * Not all signals can be replicated * Server validation may still reject the action [Related Functions](https://docs.volt.bz/docs/signals/replicatesignal#related-functions) ----------------------------------------------------------------------------------------- * [`firesignal`](https://docs.volt.bz/docs/signals/firesignal) - Fire locally only * [`getconnections`](https://docs.volt.bz/docs/signals/getconnections) - Get connections [getsignalwhitelist\ \ Previous Page](https://docs.volt.bz/docs/signals/getsignalwhitelist) [VoltSignal\ \ Next Page](https://docs.volt.bz/docs/voltsignal) ### On this page [Syntax](https://docs.volt.bz/docs/signals/replicatesignal#syntax) [Parameters](https://docs.volt.bz/docs/signals/replicatesignal#parameters) [Returns](https://docs.volt.bz/docs/signals/replicatesignal#returns) [Description](https://docs.volt.bz/docs/signals/replicatesignal#description) [Example](https://docs.volt.bz/docs/signals/replicatesignal#example) [Difference from firesignal](https://docs.volt.bz/docs/signals/replicatesignal#difference-from-firesignal) [Use Cases](https://docs.volt.bz/docs/signals/replicatesignal#use-cases) [Notes](https://docs.volt.bz/docs/signals/replicatesignal#notes) [Related Functions](https://docs.volt.bz/docs/signals/replicatesignal#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) getfpscap ========= Gets the current FPS cap. [Syntax](https://docs.volt.bz/docs/miscellaneous/getfpscap#syntax) ------------------------------------------------------------------- getfpscap() -> number [Returns](https://docs.volt.bz/docs/miscellaneous/getfpscap#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `number` | Current FPS cap | [Description](https://docs.volt.bz/docs/miscellaneous/getfpscap#description) ----------------------------------------------------------------------------- `getfpscap` returns the current maximum FPS setting. [Example](https://docs.volt.bz/docs/miscellaneous/getfpscap#example) --------------------------------------------------------------------- local currentCap = getfpscap() print("Current FPS cap:", currentCap) -- Toggle between capped and uncapped if currentCap == 0 then setfpscap(60) else setfpscap(0) end [Related Functions](https://docs.volt.bz/docs/miscellaneous/getfpscap#related-functions) ----------------------------------------------------------------------------------------- * [`setfpscap`](https://docs.volt.bz/docs/miscellaneous/setfpscap) - Set FPS cap [getfflag\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/getfflag) [gethwid\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/gethwid) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/getfpscap#syntax) [Returns](https://docs.volt.bz/docs/miscellaneous/getfpscap#returns) [Description](https://docs.volt.bz/docs/miscellaneous/getfpscap#description) [Example](https://docs.volt.bz/docs/miscellaneous/getfpscap#example) [Related Functions](https://docs.volt.bz/docs/miscellaneous/getfpscap#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) keyrelease ========== Simulates releasing a keyboard key. [Syntax](https://docs.volt.bz/docs/input/keyrelease#syntax) ------------------------------------------------------------ keyrelease(keycode: number) -> void [Parameters](https://docs.volt.bz/docs/input/keyrelease#parameters) -------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `keycode` | `number` | Virtual key code to release | [Returns](https://docs.volt.bz/docs/input/keyrelease#returns) -------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/keyrelease#description) ---------------------------------------------------------------------- `keyrelease` simulates releasing a keyboard key that was previously pressed with `keypress`. [Example](https://docs.volt.bz/docs/input/keyrelease#example) -------------------------------------------------------------- -- Hold shift for 1 second keypress(0x10) -- Shift task.wait(1) keyrelease(0x10) [Related Functions](https://docs.volt.bz/docs/input/keyrelease#related-functions) ---------------------------------------------------------------------------------- * [`keypress`](https://docs.volt.bz/docs/input/keypress) - Press a key * [`keyclick`](https://docs.volt.bz/docs/input/keyclick) - Press and release [keypress\ \ Previous Page](https://docs.volt.bz/docs/input/keypress) [mouse1click\ \ Next Page](https://docs.volt.bz/docs/input/mouse1click) ### On this page [Syntax](https://docs.volt.bz/docs/input/keyrelease#syntax) [Parameters](https://docs.volt.bz/docs/input/keyrelease#parameters) [Returns](https://docs.volt.bz/docs/input/keyrelease#returns) [Description](https://docs.volt.bz/docs/input/keyrelease#description) [Example](https://docs.volt.bz/docs/input/keyrelease#example) [Related Functions](https://docs.volt.bz/docs/input/keyrelease#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getproto ============== Gets a proto (nested function) from a function. [Syntax](https://docs.volt.bz/docs/debug/getproto#syntax) ---------------------------------------------------------- debug.getproto(func: function | number, index: number, activated?: boolean) -> function | table [Parameters](https://docs.volt.bz/docs/debug/getproto#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | | `index` | `number` | The proto index (1-based) | | `activated` | `boolean?` | If true, returns all activated instances | [Returns](https://docs.volt.bz/docs/debug/getproto#returns) ------------------------------------------------------------ | Type | Description | | --- | --- | | `function` | The proto at the specified index (if `activated` is false/nil) | | `table` | Array of activated instances (if `activated` is true) | [Description](https://docs.volt.bz/docs/debug/getproto#description) -------------------------------------------------------------------- `debug.getproto` retrieves a nested function definition (proto) from within a function. Protos are functions defined inside other functions. [Example](https://docs.volt.bz/docs/debug/getproto#example) ------------------------------------------------------------ local function outer() local function inner1() print("inner1") end local function inner2() print("inner2") end inner1() inner2() end -- Get the first nested function local proto1 = debug.getproto(outer, 1) proto1() -- Output: inner1 -- Get the second nested function local proto2 = debug.getproto(outer, 2) proto2() -- Output: inner2 [Activated Instances](https://docs.volt.bz/docs/debug/getproto#activated-instances) ------------------------------------------------------------------------------------ When `activated` is true, returns all instances of the proto that have been created: local instances = {} local function factory() local function create() return {} end table.insert(instances, create()) table.insert(instances, create()) end factory() -- Get all activated instances of the inner function local activated = debug.getproto(factory, 1, true) print(#activated) -- Number of times the inner function was instantiated [Related Functions](https://docs.volt.bz/docs/debug/getproto#related-functions) -------------------------------------------------------------------------------- * [`debug.getprotos`](https://docs.volt.bz/docs/debug/getprotos) - Get all protos from a function [debug.getinfo\ \ Previous Page](https://docs.volt.bz/docs/debug/getinfo) [debug.getprotos\ \ Next Page](https://docs.volt.bz/docs/debug/getprotos) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getproto#syntax) [Parameters](https://docs.volt.bz/docs/debug/getproto#parameters) [Returns](https://docs.volt.bz/docs/debug/getproto#returns) [Description](https://docs.volt.bz/docs/debug/getproto#description) [Example](https://docs.volt.bz/docs/debug/getproto#example) [Activated Instances](https://docs.volt.bz/docs/debug/getproto#activated-instances) [Related Functions](https://docs.volt.bz/docs/debug/getproto#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) firetouchinterest ================= Triggers a Touched or TouchEnded event between two parts. [Syntax](https://docs.volt.bz/docs/instances/firetouchinterest#syntax) ----------------------------------------------------------------------- firetouchinterest(part: BasePart, target: BasePart, toggle: number) -> void [Parameters](https://docs.volt.bz/docs/instances/firetouchinterest#parameters) ------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `part` | `BasePart` | The touching part | | `target` | `BasePart` | The part to touch | | `toggle` | `number` | 0 = TouchEnded, 1 = Touched | [Returns](https://docs.volt.bz/docs/instances/firetouchinterest#returns) ------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/instances/firetouchinterest#description) --------------------------------------------------------------------------------- `firetouchinterest` simulates a touch between two parts, firing the Touched or TouchEnded events without physical contact. [Example](https://docs.volt.bz/docs/instances/firetouchinterest#example) ------------------------------------------------------------------------- local character = game.Players.LocalPlayer.Character local hrp = character.HumanoidRootPart local targetPart = workspace.TouchPart -- Simulate touch start firetouchinterest(hrp, targetPart, 1) -- Simulate touch end firetouchinterest(hrp, targetPart, 0) [Touch and Release](https://docs.volt.bz/docs/instances/firetouchinterest#touch-and-release) --------------------------------------------------------------------------------------------- local function touch(part, target) firetouchinterest(part, target, 1) -- Touch task.wait() firetouchinterest(part, target, 0) -- Release end touch(hrp, workspace.Coin) [Collecting Items](https://docs.volt.bz/docs/instances/firetouchinterest#collecting-items) ------------------------------------------------------------------------------------------- local function collectTouchParts(parent) local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart for _, part in ipairs(parent:GetChildren()) do if part:IsA("BasePart") then firetouchinterest(hrp, part, 1) task.wait() firetouchinterest(hrp, part, 0) end end end [Notes](https://docs.volt.bz/docs/instances/firetouchinterest#notes) --------------------------------------------------------------------- * Toggle: 1 = Touched (start), 0 = TouchEnded (end) * Both events should be fired for proper simulation [fireproximityprompt\ \ Previous Page](https://docs.volt.bz/docs/instances/fireproximityprompt) [getcallbackvalue\ \ Next Page](https://docs.volt.bz/docs/instances/getcallbackvalue) ### On this page [Syntax](https://docs.volt.bz/docs/instances/firetouchinterest#syntax) [Parameters](https://docs.volt.bz/docs/instances/firetouchinterest#parameters) [Returns](https://docs.volt.bz/docs/instances/firetouchinterest#returns) [Description](https://docs.volt.bz/docs/instances/firetouchinterest#description) [Example](https://docs.volt.bz/docs/instances/firetouchinterest#example) [Touch and Release](https://docs.volt.bz/docs/instances/firetouchinterest#touch-and-release) [Collecting Items](https://docs.volt.bz/docs/instances/firetouchinterest#collecting-items) [Notes](https://docs.volt.bz/docs/instances/firetouchinterest#notes) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getmodules ========== Gets all ModuleScripts in the game. [Syntax](https://docs.volt.bz/docs/scripts/getmodules#syntax) -------------------------------------------------------------- getmodules() -> table [Returns](https://docs.volt.bz/docs/scripts/getmodules#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of all ModuleScripts | [Description](https://docs.volt.bz/docs/scripts/getmodules#description) ------------------------------------------------------------------------ `getmodules` returns an array of all ModuleScripts in the game, including those that haven't been required yet. [Example](https://docs.volt.bz/docs/scripts/getmodules#example) ---------------------------------------------------------------- local modules = getmodules() print("Total modules:", #modules) -- Find a specific module for _, module in ipairs(modules) do if module.Name == "Settings" then print("Found Settings module at:", module:GetFullName()) end end [Notes](https://docs.volt.bz/docs/scripts/getmodules#notes) ------------------------------------------------------------ * Returns all ModuleScripts, not just loaded ones * Use `getloadedmodules` for only required modules [Related Functions](https://docs.volt.bz/docs/scripts/getmodules#related-functions) ------------------------------------------------------------------------------------ * [`getloadedmodules`](https://docs.volt.bz/docs/scripts/getloadedmodules) - Get loaded modules only * [`getscripts`](https://docs.volt.bz/docs/scripts/getscripts) - Get all scripts [getloadedmodules\ \ Previous Page](https://docs.volt.bz/docs/scripts/getloadedmodules) [getrunningscripts\ \ Next Page](https://docs.volt.bz/docs/scripts/getrunningscripts) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getmodules#syntax) [Returns](https://docs.volt.bz/docs/scripts/getmodules#returns) [Description](https://docs.volt.bz/docs/scripts/getmodules#description) [Example](https://docs.volt.bz/docs/scripts/getmodules#example) [Notes](https://docs.volt.bz/docs/scripts/getmodules#notes) [Related Functions](https://docs.volt.bz/docs/scripts/getmodules#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) isexecutorclosure ================= Checks if a function originates from volt. [Syntax](https://docs.volt.bz/docs/closures/isexecutorclosure#syntax) ---------------------------------------------------------------------- isexecutorclosure(func: function) -> boolean [Parameters](https://docs.volt.bz/docs/closures/isexecutorclosure#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to check | [Returns](https://docs.volt.bz/docs/closures/isexecutorclosure#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `boolean` | `true` if the function is from volt, `false` otherwise | [Description](https://docs.volt.bz/docs/closures/isexecutorclosure#description) -------------------------------------------------------------------------------- `isexecutorclosure` determines whether a function was created by or is part of volt's environment. This includes both volt-provided functions (like `loadstring`, `hookfunction`) and functions defined in your scripts. [Example](https://docs.volt.bz/docs/closures/isexecutorclosure#example) ------------------------------------------------------------------------ -- Volt functions return true print(isexecutorclosure(loadstring)) -- true print(isexecutorclosure(hookfunction)) -- true -- Your script functions return true local function myFunc() return "hello" end print(isexecutorclosure(myFunc)) -- true -- Game functions return false print(isexecutorclosure(print)) -- false print(isexecutorclosure(game.GetService)) -- false [Related Functions](https://docs.volt.bz/docs/closures/isexecutorclosure#related-functions) -------------------------------------------------------------------------------------------- * [`checkcaller`](https://docs.volt.bz/docs/closures/checkcaller) - Check if the current call is from volt's thread * [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) - Check if a function is a C closure * [`islclosure`](https://docs.volt.bz/docs/closures/islclosure) - Check if a function is a Luau closure [Aliases](https://docs.volt.bz/docs/closures/isexecutorclosure#aliases) ------------------------------------------------------------------------ * `checkclosure` * `isourclosure` [iscclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/iscclosure) [isfunctionhooked\ \ Next Page](https://docs.volt.bz/docs/closures/isfunctionhooked) ### On this page [Syntax](https://docs.volt.bz/docs/closures/isexecutorclosure#syntax) [Parameters](https://docs.volt.bz/docs/closures/isexecutorclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/isexecutorclosure#returns) [Description](https://docs.volt.bz/docs/closures/isexecutorclosure#description) [Example](https://docs.volt.bz/docs/closures/isexecutorclosure#example) [Related Functions](https://docs.volt.bz/docs/closures/isexecutorclosure#related-functions) [Aliases](https://docs.volt.bz/docs/closures/isexecutorclosure#aliases) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) gethwid ======= Gets the hardware identifier for the current machine. [Syntax](https://docs.volt.bz/docs/miscellaneous/gethwid#syntax) ----------------------------------------------------------------- gethwid() -> string [Returns](https://docs.volt.bz/docs/miscellaneous/gethwid#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | Unique hardware identifier | [Description](https://docs.volt.bz/docs/miscellaneous/gethwid#description) --------------------------------------------------------------------------- `gethwid` returns a unique identifier for the current machine based on hardware characteristics. [Example](https://docs.volt.bz/docs/miscellaneous/gethwid#example) ------------------------------------------------------------------- local hwid = gethwid() print("Your HWID:", hwid) [Notes](https://docs.volt.bz/docs/miscellaneous/gethwid#notes) --------------------------------------------------------------- * The HWID is unique per machine * Used for license verification and anti-cheat [Related Functions](https://docs.volt.bz/docs/miscellaneous/gethwid#related-functions) --------------------------------------------------------------------------------------- * [`identifyexecutor`](https://docs.volt.bz/docs/miscellaneous/identifyexecutor) - Get executor info [getfpscap\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/getfpscap) [identifyexecutor\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/identifyexecutor) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/gethwid#syntax) [Returns](https://docs.volt.bz/docs/miscellaneous/gethwid#returns) [Description](https://docs.volt.bz/docs/miscellaneous/gethwid#description) [Example](https://docs.volt.bz/docs/miscellaneous/gethwid#example) [Notes](https://docs.volt.bz/docs/miscellaneous/gethwid#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/gethwid#related-functions) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getrunningscripts ================= Returns all currently running scripts. [Syntax](https://docs.volt.bz/docs/scripts/getrunningscripts#syntax) --------------------------------------------------------------------- getrunningscripts() -> table [Returns](https://docs.volt.bz/docs/scripts/getrunningscripts#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of running LocalScripts | [Description](https://docs.volt.bz/docs/scripts/getrunningscripts#description) ------------------------------------------------------------------------------- `getrunningscripts` returns all LocalScripts that are currently executing in the game. [Example](https://docs.volt.bz/docs/scripts/getrunningscripts#example) ----------------------------------------------------------------------- local scripts = getrunningscripts() print("Running scripts:", #scripts) for _, script in ipairs(scripts) do print("-", script:GetFullName()) end [Monitoring Scripts](https://docs.volt.bz/docs/scripts/getrunningscripts#monitoring-scripts) --------------------------------------------------------------------------------------------- local function listRunningScripts() local scripts = getrunningscripts() print("=== Running Scripts ===") for i, script in ipairs(scripts) do print(i, script.Name, script:GetFullName()) end print("Total:", #scripts) end listRunningScripts() [Related Functions](https://docs.volt.bz/docs/scripts/getrunningscripts#related-functions) ------------------------------------------------------------------------------------------- * [`getloadedmodules`](https://docs.volt.bz/docs/scripts/getloadedmodules) - Get loaded modules * [`getscripts`](https://docs.volt.bz/docs/scripts/getscripts) - Get all scripts * [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) - Get a script's environment [getmodules\ \ Previous Page](https://docs.volt.bz/docs/scripts/getmodules) [getscriptbytecode\ \ Next Page](https://docs.volt.bz/docs/scripts/getscriptbytecode) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getrunningscripts#syntax) [Returns](https://docs.volt.bz/docs/scripts/getrunningscripts#returns) [Description](https://docs.volt.bz/docs/scripts/getrunningscripts#description) [Example](https://docs.volt.bz/docs/scripts/getrunningscripts#example) [Monitoring Scripts](https://docs.volt.bz/docs/scripts/getrunningscripts#monitoring-scripts) [Related Functions](https://docs.volt.bz/docs/scripts/getrunningscripts#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) getcallbackvalue ================ Gets the function assigned to a callback property. [Syntax](https://docs.volt.bz/docs/instances/getcallbackvalue#syntax) ---------------------------------------------------------------------- getcallbackvalue(instance: Instance, property: string) -> function? [Parameters](https://docs.volt.bz/docs/instances/getcallbackvalue#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance | | `property` | `string` | The callback property name | [Returns](https://docs.volt.bz/docs/instances/getcallbackvalue#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `function?` | The callback function, or nil if not set | [Description](https://docs.volt.bz/docs/instances/getcallbackvalue#description) -------------------------------------------------------------------------------- `getcallbackvalue` retrieves the function assigned to a callback property like `OnInvoke` or `OnClientEvent`. [Example](https://docs.volt.bz/docs/instances/getcallbackvalue#example) ------------------------------------------------------------------------ -- Create a BindableFunction local bindable = Instance.new("BindableFunction") bindable.OnInvoke = function(arg) return arg * 2 end -- Get the callback local callback = getcallbackvalue(bindable, "OnInvoke") print(callback(5)) -- 10 [Inspecting Remote Callbacks](https://docs.volt.bz/docs/instances/getcallbackvalue#inspecting-remote-callbacks) ---------------------------------------------------------------------------------------------------------------- -- Find RemoteFunction callbacks for _, obj in ipairs(game:GetDescendants()) do if obj:IsA("RemoteFunction") then local callback = getcallbackvalue(obj, "OnClientInvoke") if callback then print("Found callback on:", obj:GetFullName()) end end end [Notes](https://docs.volt.bz/docs/instances/getcallbackvalue#notes) -------------------------------------------------------------------- * Common callback properties: `OnInvoke`, `OnClientInvoke`, `OnServerInvoke` * Returns nil if no callback is set [firetouchinterest\ \ Previous Page](https://docs.volt.bz/docs/instances/firetouchinterest) [gethui\ \ Next Page](https://docs.volt.bz/docs/instances/gethui) ### On this page [Syntax](https://docs.volt.bz/docs/instances/getcallbackvalue#syntax) [Parameters](https://docs.volt.bz/docs/instances/getcallbackvalue#parameters) [Returns](https://docs.volt.bz/docs/instances/getcallbackvalue#returns) [Description](https://docs.volt.bz/docs/instances/getcallbackvalue#description) [Example](https://docs.volt.bz/docs/instances/getcallbackvalue#example) [Inspecting Remote Callbacks](https://docs.volt.bz/docs/instances/getcallbackvalue#inspecting-remote-callbacks) [Notes](https://docs.volt.bz/docs/instances/getcallbackvalue#notes) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse1click =========== Simulates a left mouse click. [Syntax](https://docs.volt.bz/docs/input/mouse1click#syntax) ------------------------------------------------------------- mouse1click() -> void [Returns](https://docs.volt.bz/docs/input/mouse1click#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse1click#description) ----------------------------------------------------------------------- `mouse1click` simulates a complete left mouse button click (press and release). [Example](https://docs.volt.bz/docs/input/mouse1click#example) --------------------------------------------------------------- -- Single click mouse1click() -- Double click mouse1click() task.wait(0.05) mouse1click() [Related Functions](https://docs.volt.bz/docs/input/mouse1click#related-functions) ----------------------------------------------------------------------------------- * [`mouse1press`](https://docs.volt.bz/docs/input/mouse1press) - Press left mouse * [`mouse1release`](https://docs.volt.bz/docs/input/mouse1release) - Release left mouse * [`mouse2click`](https://docs.volt.bz/docs/input/mouse2click) - Right click [keyrelease\ \ Previous Page](https://docs.volt.bz/docs/input/keyrelease) [mouse1press\ \ Next Page](https://docs.volt.bz/docs/input/mouse1press) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse1click#syntax) [Returns](https://docs.volt.bz/docs/input/mouse1click#returns) [Description](https://docs.volt.bz/docs/input/mouse1click#description) [Example](https://docs.volt.bz/docs/input/mouse1click#example) [Related Functions](https://docs.volt.bz/docs/input/mouse1click#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) gethui ====== Returns the hidden UI container. [Syntax](https://docs.volt.bz/docs/instances/gethui#syntax) ------------------------------------------------------------ gethui() -> Instance [Returns](https://docs.volt.bz/docs/instances/gethui#returns) -------------------------------------------------------------- | Type | Description | | --- | --- | | `Instance` | The hidden UI container | [Description](https://docs.volt.bz/docs/instances/gethui#description) ---------------------------------------------------------------------- `gethui` returns a special container for UI that is hidden from game scripts. [Example](https://docs.volt.bz/docs/instances/gethui#example) -------------------------------------------------------------- local gui = Instance.new("ScreenGui") gui.Name = "MyHiddenGui" gui.Parent = gethui() local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 200, 0, 100) frame.Position = UDim2.new(0.5, -100, 0.5, -50) frame.Parent = gui [Notes](https://docs.volt.bz/docs/instances/gethui#notes) ---------------------------------------------------------- * Use for UIs you want to hide from being accessed by a game script * The container behaves like a normal GUI container [getcallbackvalue\ \ Previous Page](https://docs.volt.bz/docs/instances/getcallbackvalue) [getinstancecache\ \ Next Page](https://docs.volt.bz/docs/instances/getinstancecache) ### On this page [Syntax](https://docs.volt.bz/docs/instances/gethui#syntax) [Returns](https://docs.volt.bz/docs/instances/gethui#returns) [Description](https://docs.volt.bz/docs/instances/gethui#description) [Example](https://docs.volt.bz/docs/instances/gethui#example) [Notes](https://docs.volt.bz/docs/instances/gethui#notes) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getscriptbytecode ================= Gets the compiled bytecode of a script. [Syntax](https://docs.volt.bz/docs/scripts/getscriptbytecode#syntax) --------------------------------------------------------------------- getscriptbytecode(script: LocalScript | ModuleScript) -> string [Parameters](https://docs.volt.bz/docs/scripts/getscriptbytecode#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `script` | `LocalScript` or `ModuleScript` | The script | [Returns](https://docs.volt.bz/docs/scripts/getscriptbytecode#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | The compiled Luau bytecode | [Description](https://docs.volt.bz/docs/scripts/getscriptbytecode#description) ------------------------------------------------------------------------------- `getscriptbytecode` extracts the compiled bytecode from a script. This can be used for analysis or decompilation. [Example](https://docs.volt.bz/docs/scripts/getscriptbytecode#example) ----------------------------------------------------------------------- local scripts = getrunningscripts() if #scripts > 0 then local bytecode = getscriptbytecode(scripts[1]) print("Bytecode length:", #bytecode) -- Save to file for analysis writefile("script_bytecode.bin", bytecode) end [Notes](https://docs.volt.bz/docs/scripts/getscriptbytecode#notes) ------------------------------------------------------------------- * Bytecode is in compiled Luau format * Can be decompiled with appropriate tools * Useful for script analysis and research [Related Functions](https://docs.volt.bz/docs/scripts/getscriptbytecode#related-functions) ------------------------------------------------------------------------------------------- * [`getscripthash`](https://docs.volt.bz/docs/scripts/getscripthash) - Get a hash of the bytecode * [`getscriptclosure`](https://docs.volt.bz/docs/scripts/getscriptclosure) - Get the script's function [Aliases](https://docs.volt.bz/docs/scripts/getscriptbytecode#aliases) ----------------------------------------------------------------------- * `dumpstring` [getrunningscripts\ \ Previous Page](https://docs.volt.bz/docs/scripts/getrunningscripts) [getscriptclosure\ \ Next Page](https://docs.volt.bz/docs/scripts/getscriptclosure) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getscriptbytecode#syntax) [Parameters](https://docs.volt.bz/docs/scripts/getscriptbytecode#parameters) [Returns](https://docs.volt.bz/docs/scripts/getscriptbytecode#returns) [Description](https://docs.volt.bz/docs/scripts/getscriptbytecode#description) [Example](https://docs.volt.bz/docs/scripts/getscriptbytecode#example) [Notes](https://docs.volt.bz/docs/scripts/getscriptbytecode#notes) [Related Functions](https://docs.volt.bz/docs/scripts/getscriptbytecode#related-functions) [Aliases](https://docs.volt.bz/docs/scripts/getscriptbytecode#aliases) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) isscriptable ============ Checks if a property is scriptable. [Syntax](https://docs.volt.bz/docs/reflection/isscriptable#syntax) ------------------------------------------------------------------- isscriptable(instance: Instance, property: string) -> boolean [Parameters](https://docs.volt.bz/docs/reflection/isscriptable#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance | | `property` | `string` | The property name | [Returns](https://docs.volt.bz/docs/reflection/isscriptable#returns) --------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the property is scriptable | [Description](https://docs.volt.bz/docs/reflection/isscriptable#description) ----------------------------------------------------------------------------- `isscriptable` checks whether a property can be accessed through scripts. Non-scriptable properties are hidden from the scripting API. [Example](https://docs.volt.bz/docs/reflection/isscriptable#example) --------------------------------------------------------------------- local part = Instance.new("Part") -- Check common properties print(isscriptable(part, "Name")) -- true (visible) print(isscriptable(part, "Position")) -- true (visible) print(isscriptable(part, "size_xml")) -- false (hidden) [Use Case](https://docs.volt.bz/docs/reflection/isscriptable#use-case) ----------------------------------------------------------------------- local function getAllProperties(instance) local properties = {} -- Check a list of known property names local propertyNames = {"Name", "Position", "Size", "Color", "size_xml"} for _, propName in ipairs(propertyNames) do local scriptable = isscriptable(instance, propName) properties[propName] = { scriptable = scriptable, value = scriptable and instance[propName] or gethiddenproperty(instance, propName) } end return properties end [Related Functions](https://docs.volt.bz/docs/reflection/isscriptable#related-functions) ----------------------------------------------------------------------------------------- * [`setscriptable`](https://docs.volt.bz/docs/reflection/setscriptable) - Change scriptability * [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) - Get hidden property values [isnetworkowner\ \ Previous Page](https://docs.volt.bz/docs/reflection/isnetworkowner) [sethiddenproperty\ \ Next Page](https://docs.volt.bz/docs/reflection/sethiddenproperty) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/isscriptable#syntax) [Parameters](https://docs.volt.bz/docs/reflection/isscriptable#parameters) [Returns](https://docs.volt.bz/docs/reflection/isscriptable#returns) [Description](https://docs.volt.bz/docs/reflection/isscriptable#description) [Example](https://docs.volt.bz/docs/reflection/isscriptable#example) [Use Case](https://docs.volt.bz/docs/reflection/isscriptable#use-case) [Related Functions](https://docs.volt.bz/docs/reflection/isscriptable#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) setrawmetatable =============== Sets the raw metatable of an object. [Syntax](https://docs.volt.bz/docs/metatable/setrawmetatable#syntax) --------------------------------------------------------------------- setrawmetatable(object: any, metatable: table?) -> void [Parameters](https://docs.volt.bz/docs/metatable/setrawmetatable#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `object` | `any` | The object to modify | | `metatable` | `table?` | The new metatable, or nil to remove | [Returns](https://docs.volt.bz/docs/metatable/setrawmetatable#returns) ----------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/metatable/setrawmetatable#description) ------------------------------------------------------------------------------- `setrawmetatable` sets the metatable of an object directly, bypassing normal restrictions. [Example](https://docs.volt.bz/docs/metatable/setrawmetatable#example) ----------------------------------------------------------------------- local myTable = {} -- Create a custom metatable local mt = { __index = function(self, key) return "Key not found: " .. key end } setrawmetatable(myTable, mt) print(myTable.anything) -- "Key not found: anything" [Replacing Metatables](https://docs.volt.bz/docs/metatable/setrawmetatable#replacing-metatables) ------------------------------------------------------------------------------------------------- local object = {} local originalMt = getrawmetatable(object) -- Set a new metatable setrawmetatable(object, { __tostring = function() return "Custom string!" end }) print(tostring(object)) -- "Custom string!" -- Restore original setrawmetatable(object, originalMt) [Caution](https://docs.volt.bz/docs/metatable/setrawmetatable#caution) ----------------------------------------------------------------------- Modifying metatables of Roblox objects can cause unexpected behavior or crashes. Always keep a reference to the original. [Related Functions](https://docs.volt.bz/docs/metatable/setrawmetatable#related-functions) ------------------------------------------------------------------------------------------- * [`getrawmetatable`](https://docs.volt.bz/docs/metatable/getrawmetatable) - Get a raw metatable [setnamecallmethod\ \ Previous Page](https://docs.volt.bz/docs/metatable/setnamecallmethod) [setreadonly\ \ Next Page](https://docs.volt.bz/docs/metatable/setreadonly) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/setrawmetatable#syntax) [Parameters](https://docs.volt.bz/docs/metatable/setrawmetatable#parameters) [Returns](https://docs.volt.bz/docs/metatable/setrawmetatable#returns) [Description](https://docs.volt.bz/docs/metatable/setrawmetatable#description) [Example](https://docs.volt.bz/docs/metatable/setrawmetatable#example) [Replacing Metatables](https://docs.volt.bz/docs/metatable/setrawmetatable#replacing-metatables) [Caution](https://docs.volt.bz/docs/metatable/setrawmetatable#caution) [Related Functions](https://docs.volt.bz/docs/metatable/setrawmetatable#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) setnamecallmethod ================= Sets the method name for the current `__namecall` invocation. [Syntax](https://docs.volt.bz/docs/metatable/setnamecallmethod#syntax) ----------------------------------------------------------------------- setnamecallmethod(method: string) -> void [Parameters](https://docs.volt.bz/docs/metatable/setnamecallmethod#parameters) ------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `method` | `string` | The new method name | [Returns](https://docs.volt.bz/docs/metatable/setnamecallmethod#returns) ------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/metatable/setnamecallmethod#description) --------------------------------------------------------------------------------- `setnamecallmethod` changes the method name that will be used for the current `__namecall` invocation. This allows you to redirect method calls to different methods. [Example](https://docs.volt.bz/docs/metatable/setnamecallmethod#example) ------------------------------------------------------------------------- local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local method = getnamecallmethod() -- Redirect Kick to a harmless method if method == "Kick" then setnamecallmethod("GetFullName") return oldNamecall(self, ...) end return oldNamecall(self, ...) end)) [Spoofing Example](https://docs.volt.bz/docs/metatable/setnamecallmethod#spoofing-example) ------------------------------------------------------------------------------------------- local oldNamecall oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...) local method = getnamecallmethod() -- Change FireServer to something else for debugging if method == "FireServer" then print("FireServer intercepted, redirecting...") setnamecallmethod("Fire") end return oldNamecall(self, ...) end)) [Notes](https://docs.volt.bz/docs/metatable/setnamecallmethod#notes) --------------------------------------------------------------------- * Only works inside `__namecall` hooks * The change only affects the current call [Related Functions](https://docs.volt.bz/docs/metatable/setnamecallmethod#related-functions) --------------------------------------------------------------------------------------------- * [`getnamecallmethod`](https://docs.volt.bz/docs/metatable/getnamecallmethod) - Get current method * [`hookmetamethod`](https://docs.volt.bz/docs/closures/hookmetamethod) - Hook metamethods [makewritable\ \ Previous Page](https://docs.volt.bz/docs/metatable/makewritable) [setrawmetatable\ \ Next Page](https://docs.volt.bz/docs/metatable/setrawmetatable) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/setnamecallmethod#syntax) [Parameters](https://docs.volt.bz/docs/metatable/setnamecallmethod#parameters) [Returns](https://docs.volt.bz/docs/metatable/setnamecallmethod#returns) [Description](https://docs.volt.bz/docs/metatable/setnamecallmethod#description) [Example](https://docs.volt.bz/docs/metatable/setnamecallmethod#example) [Spoofing Example](https://docs.volt.bz/docs/metatable/setnamecallmethod#spoofing-example) [Notes](https://docs.volt.bz/docs/metatable/setnamecallmethod#notes) [Related Functions](https://docs.volt.bz/docs/metatable/setnamecallmethod#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) sethiddenproperty ================= Sets the value of a hidden property. [Syntax](https://docs.volt.bz/docs/reflection/sethiddenproperty#syntax) ------------------------------------------------------------------------ sethiddenproperty(instance: Instance, property: string, value: any) -> boolean [Parameters](https://docs.volt.bz/docs/reflection/sethiddenproperty#parameters) -------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance | | `property` | `string` | The hidden property name | | `value` | `any` | The value to set | [Returns](https://docs.volt.bz/docs/reflection/sethiddenproperty#returns) -------------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | Whether the property was hidden | [Description](https://docs.volt.bz/docs/reflection/sethiddenproperty#description) ---------------------------------------------------------------------------------- `sethiddenproperty` sets the value of a property that isn't normally accessible through scripts. [Example](https://docs.volt.bz/docs/reflection/sethiddenproperty#example) -------------------------------------------------------------------------- local part = Instance.new("Part") -- Set a hidden property local wasHidden = sethiddenproperty(part, "size_xml", "1, 1, 1") print("Was hidden:", wasHidden) [Caution](https://docs.volt.bz/docs/reflection/sethiddenproperty#caution) -------------------------------------------------------------------------- Modifying hidden properties can cause unexpected behavior or break instances. Only modify properties you understand. [Related Functions](https://docs.volt.bz/docs/reflection/sethiddenproperty#related-functions) ---------------------------------------------------------------------------------------------- * [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) - Get a hidden property * [`setscriptable`](https://docs.volt.bz/docs/reflection/setscriptable) - Make properties scriptable [isscriptable\ \ Previous Page](https://docs.volt.bz/docs/reflection/isscriptable) [setscriptable\ \ Next Page](https://docs.volt.bz/docs/reflection/setscriptable) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/sethiddenproperty#syntax) [Parameters](https://docs.volt.bz/docs/reflection/sethiddenproperty#parameters) [Returns](https://docs.volt.bz/docs/reflection/sethiddenproperty#returns) [Description](https://docs.volt.bz/docs/reflection/sethiddenproperty#description) [Example](https://docs.volt.bz/docs/reflection/sethiddenproperty#example) [Caution](https://docs.volt.bz/docs/reflection/sethiddenproperty#caution) [Related Functions](https://docs.volt.bz/docs/reflection/sethiddenproperty#related-functions) --- # Volt Documentation [Metatable](https://docs.volt.bz/docs/metatable) setreadonly =========== Sets a table's read-only status. [Syntax](https://docs.volt.bz/docs/metatable/setreadonly#syntax) ----------------------------------------------------------------- setreadonly(table: table, readonly: boolean) -> void [Parameters](https://docs.volt.bz/docs/metatable/setreadonly#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `table` | `table` | The table to modify | | `readonly` | `boolean` | The new read-only status | [Returns](https://docs.volt.bz/docs/metatable/setreadonly#returns) ------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/metatable/setreadonly#description) --------------------------------------------------------------------------- `setreadonly` controls whether a table can be modified. This is essential for modifying Roblox metatables which are locked by default. [Example](https://docs.volt.bz/docs/metatable/setreadonly#example) ------------------------------------------------------------------- local mt = getrawmetatable(game) -- Unlock the metatable setreadonly(mt, false) -- Now we can modify it local oldIndex = mt.__index mt.__index = newcclosure(function(self, key) print("Accessing:", key) return oldIndex(self, key) end) -- Re-lock for safety setreadonly(mt, true) [Pattern for Safe Modification](https://docs.volt.bz/docs/metatable/setreadonly#pattern-for-safe-modification) --------------------------------------------------------------------------------------------------------------- local function safeModifyMetatable(object, modifier) local mt = getrawmetatable(object) local wasReadonly = isreadonly(mt) if wasReadonly then setreadonly(mt, false) end modifier(mt) if wasReadonly then setreadonly(mt, true) end end safeModifyMetatable(game, function(mt) -- Your modifications here end) [Notes](https://docs.volt.bz/docs/metatable/setreadonly#notes) --------------------------------------------------------------- * Always re-lock metatables after modification * Some anti-cheats check for unlocked metatables * Works on any Lua table, not just metatables [Related Functions](https://docs.volt.bz/docs/metatable/setreadonly#related-functions) --------------------------------------------------------------------------------------- * [`isreadonly`](https://docs.volt.bz/docs/metatable/isreadonly) - Check read-only status * [`getrawmetatable`](https://docs.volt.bz/docs/metatable/getrawmetatable) - Get the metatable [setrawmetatable\ \ Previous Page](https://docs.volt.bz/docs/metatable/setrawmetatable) [Miscellaneous\ \ Next Page](https://docs.volt.bz/docs/miscellaneous) ### On this page [Syntax](https://docs.volt.bz/docs/metatable/setreadonly#syntax) [Parameters](https://docs.volt.bz/docs/metatable/setreadonly#parameters) [Returns](https://docs.volt.bz/docs/metatable/setreadonly#returns) [Description](https://docs.volt.bz/docs/metatable/setreadonly#description) [Example](https://docs.volt.bz/docs/metatable/setreadonly#example) [Pattern for Safe Modification](https://docs.volt.bz/docs/metatable/setreadonly#pattern-for-safe-modification) [Notes](https://docs.volt.bz/docs/metatable/setreadonly#notes) [Related Functions](https://docs.volt.bz/docs/metatable/setreadonly#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) isfunctionhooked ================ Checks if a function has been hooked. [Syntax](https://docs.volt.bz/docs/closures/isfunctionhooked#syntax) --------------------------------------------------------------------- isfunctionhooked(func: function) -> boolean [Parameters](https://docs.volt.bz/docs/closures/isfunctionhooked#parameters) ----------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to check | [Returns](https://docs.volt.bz/docs/closures/isfunctionhooked#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if the function is hooked | [Description](https://docs.volt.bz/docs/closures/isfunctionhooked#description) ------------------------------------------------------------------------------- `isfunctionhooked` checks whether a function has been replaced using `hookfunction` or similar hooking methods. [Example](https://docs.volt.bz/docs/closures/isfunctionhooked#example) ----------------------------------------------------------------------- local function myFunc() return "original" end print(isfunctionhooked(myFunc)) -- false hookfunction(myFunc, function() return "hooked" end) print(isfunctionhooked(myFunc)) -- true [Use Cases](https://docs.volt.bz/docs/closures/isfunctionhooked#use-cases) --------------------------------------------------------------------------- * Checking if a function has already been hooked * Avoiding double-hooking * Debugging hook states [Related Functions](https://docs.volt.bz/docs/closures/isfunctionhooked#related-functions) ------------------------------------------------------------------------------------------- * [`hookfunction`](https://docs.volt.bz/docs/closures/hookfunction) - Hook a function * [`restorefunction`](https://docs.volt.bz/docs/closures/restorefunction) - Restore original [isexecutorclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/isexecutorclosure) [islclosure\ \ Next Page](https://docs.volt.bz/docs/closures/islclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/isfunctionhooked#syntax) [Parameters](https://docs.volt.bz/docs/closures/isfunctionhooked#parameters) [Returns](https://docs.volt.bz/docs/closures/isfunctionhooked#returns) [Description](https://docs.volt.bz/docs/closures/isfunctionhooked#description) [Example](https://docs.volt.bz/docs/closures/isfunctionhooked#example) [Use Cases](https://docs.volt.bz/docs/closures/isfunctionhooked#use-cases) [Related Functions](https://docs.volt.bz/docs/closures/isfunctionhooked#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) isfile ====== Checks if a path points to a file. [Syntax](https://docs.volt.bz/docs/filesystem/isfile#syntax) ------------------------------------------------------------- isfile(path: string) -> boolean [Parameters](https://docs.volt.bz/docs/filesystem/isfile#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The path to check | [Returns](https://docs.volt.bz/docs/filesystem/isfile#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the path is a file | [Description](https://docs.volt.bz/docs/filesystem/isfile#description) ----------------------------------------------------------------------- `isfile` returns whether the specified path exists and is a file (not a folder). [Example](https://docs.volt.bz/docs/filesystem/isfile#example) --------------------------------------------------------------- writefile("test.txt", "Hello") makefolder("testfolder") print(isfile("test.txt")) -- true print(isfile("testfolder")) -- false (it's a folder) print(isfile("nonexistent")) -- false (doesn't exist) [Safe File Reading](https://docs.volt.bz/docs/filesystem/isfile#safe-file-reading) ----------------------------------------------------------------------------------- local function safeRead(path) if isfile(path) then return readfile(path) end return nil end local content = safeRead("config.json") if content then print("Config loaded") else print("Config not found") end [Related Functions](https://docs.volt.bz/docs/filesystem/isfile#related-functions) ----------------------------------------------------------------------------------- * [`isfolder`](https://docs.volt.bz/docs/filesystem/isfolder) - Check if path is a folder * [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) - Read file contents [getcustomasset\ \ Previous Page](https://docs.volt.bz/docs/filesystem/getcustomasset) [isfolder\ \ Next Page](https://docs.volt.bz/docs/filesystem/isfolder) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/isfile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/isfile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/isfile#returns) [Description](https://docs.volt.bz/docs/filesystem/isfile#description) [Example](https://docs.volt.bz/docs/filesystem/isfile#example) [Safe File Reading](https://docs.volt.bz/docs/filesystem/isfile#safe-file-reading) [Related Functions](https://docs.volt.bz/docs/filesystem/isfile#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) isfolder ======== Checks if a path points to a folder. [Syntax](https://docs.volt.bz/docs/filesystem/isfolder#syntax) --------------------------------------------------------------- isfolder(path: string) -> boolean [Parameters](https://docs.volt.bz/docs/filesystem/isfolder#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The path to check | [Returns](https://docs.volt.bz/docs/filesystem/isfolder#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the path is a folder | [Description](https://docs.volt.bz/docs/filesystem/isfolder#description) ------------------------------------------------------------------------- `isfolder` returns whether the specified path exists and is a folder (not a file). [Example](https://docs.volt.bz/docs/filesystem/isfolder#example) ----------------------------------------------------------------- makefolder("myfolder") writefile("myfile.txt", "Hello") print(isfolder("myfolder")) -- true print(isfolder("myfile.txt")) -- false (it's a file) print(isfolder("nonexistent")) -- false (doesn't exist) [Ensuring Folder Exists](https://docs.volt.bz/docs/filesystem/isfolder#ensuring-folder-exists) ----------------------------------------------------------------------------------------------- local function ensureFolder(path) if not isfolder(path) then makefolder(path) end end ensureFolder("data") ensureFolder("data/saves") writefile("data/saves/save1.json", "{}") [Related Functions](https://docs.volt.bz/docs/filesystem/isfolder#related-functions) ------------------------------------------------------------------------------------- * [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) - Check if path is a file * [`makefolder`](https://docs.volt.bz/docs/filesystem/makefolder) - Create a folder [isfile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/isfile) [listfiles\ \ Next Page](https://docs.volt.bz/docs/filesystem/listfiles) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/isfolder#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/isfolder#parameters) [Returns](https://docs.volt.bz/docs/filesystem/isfolder#returns) [Description](https://docs.volt.bz/docs/filesystem/isfolder#description) [Example](https://docs.volt.bz/docs/filesystem/isfolder#example) [Ensuring Folder Exists](https://docs.volt.bz/docs/filesystem/isfolder#ensuring-folder-exists) [Related Functions](https://docs.volt.bz/docs/filesystem/isfolder#related-functions) --- # Volt Documentation [Reflection](https://docs.volt.bz/docs/reflection) setscriptable ============= Sets whether a property is scriptable. [Syntax](https://docs.volt.bz/docs/reflection/setscriptable#syntax) -------------------------------------------------------------------- setscriptable(instance: Instance, property: string, scriptable: boolean) -> boolean [Parameters](https://docs.volt.bz/docs/reflection/setscriptable#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `instance` | `Instance` | The instance | | `property` | `string` | The property name | | `scriptable` | `boolean` | The new scriptability | [Returns](https://docs.volt.bz/docs/reflection/setscriptable#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | The previous scriptability | [Description](https://docs.volt.bz/docs/reflection/setscriptable#description) ------------------------------------------------------------------------------ `setscriptable` changes whether a property is accessible through normal scripting. This can make hidden properties accessible via regular property access. [Example](https://docs.volt.bz/docs/reflection/setscriptable#example) ---------------------------------------------------------------------- local part = Instance.new("Part") -- Make a hidden property scriptable local wasScriptable = setscriptable(part, "size_xml", true) -- Now we can access it normally print(part.size_xml) -- Restore original state setscriptable(part, "size_xml", wasScriptable) [Making Hidden Properties Accessible](https://docs.volt.bz/docs/reflection/setscriptable#making-hidden-properties-accessible) ------------------------------------------------------------------------------------------------------------------------------ local function exposeProperty(instance, propName) local wasScriptable = setscriptable(instance, propName, true) return function() setscriptable(instance, propName, wasScriptable) end end -- Use local restore = exposeProperty(part, "size_xml") print(part.size_xml) -- Now accessible restore() -- Restore original state [Related Functions](https://docs.volt.bz/docs/reflection/setscriptable#related-functions) ------------------------------------------------------------------------------------------ * [`isscriptable`](https://docs.volt.bz/docs/reflection/isscriptable) - Check scriptability * [`gethiddenproperty`](https://docs.volt.bz/docs/reflection/gethiddenproperty) - Alternative for hidden properties [sethiddenproperty\ \ Previous Page](https://docs.volt.bz/docs/reflection/sethiddenproperty) [setsimulationradius\ \ Next Page](https://docs.volt.bz/docs/reflection/setsimulationradius) ### On this page [Syntax](https://docs.volt.bz/docs/reflection/setscriptable#syntax) [Parameters](https://docs.volt.bz/docs/reflection/setscriptable#parameters) [Returns](https://docs.volt.bz/docs/reflection/setscriptable#returns) [Description](https://docs.volt.bz/docs/reflection/setscriptable#description) [Example](https://docs.volt.bz/docs/reflection/setscriptable#example) [Making Hidden Properties Accessible](https://docs.volt.bz/docs/reflection/setscriptable#making-hidden-properties-accessible) [Related Functions](https://docs.volt.bz/docs/reflection/setscriptable#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getprotos =============== Gets all protos (nested functions) from a function. [Syntax](https://docs.volt.bz/docs/debug/getprotos#syntax) ----------------------------------------------------------- debug.getprotos(func: function | number) -> table [Parameters](https://docs.volt.bz/docs/debug/getprotos#parameters) ------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | [Returns](https://docs.volt.bz/docs/debug/getprotos#returns) ------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | An array of all protos in the function | [Description](https://docs.volt.bz/docs/debug/getprotos#description) --------------------------------------------------------------------- `debug.getprotos` returns a table containing all nested function definitions within a function. [Example](https://docs.volt.bz/docs/debug/getprotos#example) ------------------------------------------------------------- local function container() local function a() return 1 end local function b() return 2 end local function c() return 3 end return a() + b() + c() end local protos = debug.getprotos(container) print(#protos) -- 3 for i, proto in ipairs(protos) do print(i, proto()) -- Calls each nested function end --[[\ Output:\ 1 1\ 2 2\ 3 3\ ]] [Use Cases](https://docs.volt.bz/docs/debug/getprotos#use-cases) ----------------------------------------------------------------- * **Script analysis**: Find all functions defined within a script * **Hooking**: Locate specific nested functions to hook * **Debugging**: Inspect the structure of complex functions [Related Functions](https://docs.volt.bz/docs/debug/getprotos#related-functions) --------------------------------------------------------------------------------- * [`debug.getproto`](https://docs.volt.bz/docs/debug/getproto) - Get a single proto by index [debug.getproto\ \ Previous Page](https://docs.volt.bz/docs/debug/getproto) [debug.getstack\ \ Next Page](https://docs.volt.bz/docs/debug/getstack) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getprotos#syntax) [Parameters](https://docs.volt.bz/docs/debug/getprotos#parameters) [Returns](https://docs.volt.bz/docs/debug/getprotos#returns) [Description](https://docs.volt.bz/docs/debug/getprotos#description) [Example](https://docs.volt.bz/docs/debug/getprotos#example) [Use Cases](https://docs.volt.bz/docs/debug/getprotos#use-cases) [Related Functions](https://docs.volt.bz/docs/debug/getprotos#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleprint ============= Prints text to the console window. [Syntax](https://docs.volt.bz/docs/console/rconsoleprint#syntax) ----------------------------------------------------------------- rconsoleprint(text: string) -> void [Aliases](https://docs.volt.bz/docs/console/rconsoleprint#aliases) ------------------------------------------------------------------- * `consoleprint` [Parameters](https://docs.volt.bz/docs/console/rconsoleprint#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The text to print | [Returns](https://docs.volt.bz/docs/console/rconsoleprint#returns) ------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoleprint#description) --------------------------------------------------------------------------- `rconsoleprint` outputs text to the console window. Unlike the other console print functions, this prints plain text without any formatting or prefix. [Example](https://docs.volt.bz/docs/console/rconsoleprint#example) ------------------------------------------------------------------- rconsoleshow() -- Print text with newlines rconsoleprint("Hello, World!\n") rconsoleprint("Line 2\n") -- Print without newline (continues on same line) rconsoleprint("Part 1... ") rconsoleprint("Part 2\n") [Notes](https://docs.volt.bz/docs/console/rconsoleprint#notes) --------------------------------------------------------------- * Use `\n` for newlines * Does not automatically add newlines [Related Functions](https://docs.volt.bz/docs/console/rconsoleprint#related-functions) --------------------------------------------------------------------------------------- * [`rconsoleinfo`](https://docs.volt.bz/docs/console/rconsoleinfo) - Print info message * [`rconsolewarn`](https://docs.volt.bz/docs/console/rconsolewarn) - Print warning * [`rconsoleerr`](https://docs.volt.bz/docs/console/rconsoleerr) - Print error [rconsolename\ \ Previous Page](https://docs.volt.bz/docs/console/rconsolename) [rconsoleshow\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleshow) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleprint#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsoleprint#aliases) [Parameters](https://docs.volt.bz/docs/console/rconsoleprint#parameters) [Returns](https://docs.volt.bz/docs/console/rconsoleprint#returns) [Description](https://docs.volt.bz/docs/console/rconsoleprint#description) [Example](https://docs.volt.bz/docs/console/rconsoleprint#example) [Notes](https://docs.volt.bz/docs/console/rconsoleprint#notes) [Related Functions](https://docs.volt.bz/docs/console/rconsoleprint#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsolename ============ Sets the console window title. [Syntax](https://docs.volt.bz/docs/console/rconsolename#syntax) ---------------------------------------------------------------- rconsolename(title: string) -> void [Aliases](https://docs.volt.bz/docs/console/rconsolename#aliases) ------------------------------------------------------------------ * `rconsolesettitle` * `consolesettitle` [Parameters](https://docs.volt.bz/docs/console/rconsolename#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `title` | `string` | The new window title | [Returns](https://docs.volt.bz/docs/console/rconsolename#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsolename#description) -------------------------------------------------------------------------- `rconsolename` sets the title of the console window, which appears in the title bar. [Example](https://docs.volt.bz/docs/console/rconsolename#example) ------------------------------------------------------------------ rconsoleshow() -- Set a custom title rconsolename("My Script v1.0") rconsoleprint("Console is ready!\n") [Related Functions](https://docs.volt.bz/docs/console/rconsolename#related-functions) -------------------------------------------------------------------------------------- * [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) - Show the console [rconsoleinput\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleinput) [rconsoleprint\ \ Next Page](https://docs.volt.bz/docs/console/rconsoleprint) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsolename#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsolename#aliases) [Parameters](https://docs.volt.bz/docs/console/rconsolename#parameters) [Returns](https://docs.volt.bz/docs/console/rconsolename#returns) [Description](https://docs.volt.bz/docs/console/rconsolename#description) [Example](https://docs.volt.bz/docs/console/rconsolename#example) [Related Functions](https://docs.volt.bz/docs/console/rconsolename#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) setfpscap ========= Sets the FPS cap for the game. [Syntax](https://docs.volt.bz/docs/miscellaneous/setfpscap#syntax) ------------------------------------------------------------------- setfpscap(fps: number) -> void [Parameters](https://docs.volt.bz/docs/miscellaneous/setfpscap#parameters) --------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `fps` | `number` | The FPS cap to set | [Returns](https://docs.volt.bz/docs/miscellaneous/setfpscap#returns) --------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/setfpscap#description) ----------------------------------------------------------------------------- `setfpscap` sets the maximum frames per second the game will render at. Use 0 to uncap. [Example](https://docs.volt.bz/docs/miscellaneous/setfpscap#example) --------------------------------------------------------------------- -- Cap at 60 FPS setfpscap(60) -- Uncap FPS setfpscap(0) -- Cap at 144 FPS setfpscap(144) [Notes](https://docs.volt.bz/docs/miscellaneous/setfpscap#notes) ----------------------------------------------------------------- * Set to 0 for unlimited FPS * Higher FPS may increase CPU/GPU usage * Default Roblox cap is 60 FPS [Related Functions](https://docs.volt.bz/docs/miscellaneous/setfpscap#related-functions) ----------------------------------------------------------------------------------------- * [`getfpscap`](https://docs.volt.bz/docs/miscellaneous/getfpscap) - Get current FPS cap [setfflag\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/setfflag) [oth\ \ Next Page](https://docs.volt.bz/docs/oth) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/setfpscap#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/setfpscap#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/setfpscap#returns) [Description](https://docs.volt.bz/docs/miscellaneous/setfpscap#description) [Example](https://docs.volt.bz/docs/miscellaneous/setfpscap#example) [Notes](https://docs.volt.bz/docs/miscellaneous/setfpscap#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/setfpscap#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getstack ============== Gets a value from the stack at a specific level and index. [Syntax](https://docs.volt.bz/docs/debug/getstack#syntax) ---------------------------------------------------------- debug.getstack(level: number, index: number) -> any [Parameters](https://docs.volt.bz/docs/debug/getstack#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `level` | `number` | The stack level (1 = current function) | | `index` | `number` | The stack slot index | [Returns](https://docs.volt.bz/docs/debug/getstack#returns) ------------------------------------------------------------ | Type | Description | | --- | --- | | `any` | The value at the specified stack position | [Description](https://docs.volt.bz/docs/debug/getstack#description) -------------------------------------------------------------------- `debug.getstack` retrieves a value from the call stack. This allows you to read local variables and temporary values from any level of the current call stack. [Example](https://docs.volt.bz/docs/debug/getstack#example) ------------------------------------------------------------ local function level2() local secret = "hidden value" level1() end local function level1() -- Get the 'secret' variable from level2 local value = debug.getstack(2, 1) print(value) -- "hidden value" end level2() [Stack Levels](https://docs.volt.bz/docs/debug/getstack#stack-levels) ---------------------------------------------------------------------- | Level | Meaning | | --- | --- | | 1 | Current function | | 2 | Calling function | | 3 | Caller of the caller | | ... | And so on | [Notes](https://docs.volt.bz/docs/debug/getstack#notes) -------------------------------------------------------- * Stack indices correspond to local variable slots * The exact index depends on the function's compiled bytecode * Values may include locals, parameters, and temporaries [Related Functions](https://docs.volt.bz/docs/debug/getstack#related-functions) -------------------------------------------------------------------------------- * [`debug.setstack`](https://docs.volt.bz/docs/debug/setstack) - Modify a stack value [debug.getprotos\ \ Previous Page](https://docs.volt.bz/docs/debug/getprotos) [debug.getupvalue\ \ Next Page](https://docs.volt.bz/docs/debug/getupvalue) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getstack#syntax) [Parameters](https://docs.volt.bz/docs/debug/getstack#parameters) [Returns](https://docs.volt.bz/docs/debug/getstack#returns) [Description](https://docs.volt.bz/docs/debug/getstack#description) [Example](https://docs.volt.bz/docs/debug/getstack#example) [Stack Levels](https://docs.volt.bz/docs/debug/getstack#stack-levels) [Notes](https://docs.volt.bz/docs/debug/getstack#notes) [Related Functions](https://docs.volt.bz/docs/debug/getstack#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse1press =========== Simulates pressing the left mouse button. [Syntax](https://docs.volt.bz/docs/input/mouse1press#syntax) ------------------------------------------------------------- mouse1press() -> void [Returns](https://docs.volt.bz/docs/input/mouse1press#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse1press#description) ----------------------------------------------------------------------- `mouse1press` simulates pressing down the left mouse button. Use `mouse1release` to release it. [Example](https://docs.volt.bz/docs/input/mouse1press#example) --------------------------------------------------------------- -- Hold left mouse for 1 second mouse1press() task.wait(1) mouse1release() [Drag Example](https://docs.volt.bz/docs/input/mouse1press#drag-example) ------------------------------------------------------------------------- -- Simulate dragging mouse1press() for i = 1, 100 do mousemoverel(5, 0) task.wait(0.01) end mouse1release() [Related Functions](https://docs.volt.bz/docs/input/mouse1press#related-functions) ----------------------------------------------------------------------------------- * [`mouse1release`](https://docs.volt.bz/docs/input/mouse1release) - Release left mouse * [`mouse1click`](https://docs.volt.bz/docs/input/mouse1click) - Click left mouse [mouse1click\ \ Previous Page](https://docs.volt.bz/docs/input/mouse1click) [mouse1release\ \ Next Page](https://docs.volt.bz/docs/input/mouse1release) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse1press#syntax) [Returns](https://docs.volt.bz/docs/input/mouse1press#returns) [Description](https://docs.volt.bz/docs/input/mouse1press#description) [Example](https://docs.volt.bz/docs/input/mouse1press#example) [Drag Example](https://docs.volt.bz/docs/input/mouse1press#drag-example) [Related Functions](https://docs.volt.bz/docs/input/mouse1press#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) messagebox ========== Displays a message box dialog. [Syntax](https://docs.volt.bz/docs/miscellaneous/messagebox#syntax) -------------------------------------------------------------------- messagebox(text: string, caption: string, flags: number) -> number [Parameters](https://docs.volt.bz/docs/miscellaneous/messagebox#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The message text | | `caption` | `string` | The window title | | `flags` | `number` | Button and icon flags | [Returns](https://docs.volt.bz/docs/miscellaneous/messagebox#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `number` | The button pressed by the user | [Description](https://docs.volt.bz/docs/miscellaneous/messagebox#description) ------------------------------------------------------------------------------ `messagebox` displays a Windows-style message box with customizable buttons and icons. [Common Flags](https://docs.volt.bz/docs/miscellaneous/messagebox#common-flags) -------------------------------------------------------------------------------- | Flag | Description | | --- | --- | | `0` | OK button | | `1` | OK + Cancel | | `4` | Yes + No | | `16` | Error icon | | `32` | Question icon | | `48` | Warning icon | | `64` | Info icon | [Return Values](https://docs.volt.bz/docs/miscellaneous/messagebox#return-values) ---------------------------------------------------------------------------------- | Value | Description | | --- | --- | | `1` | OK | | `2` | Cancel | | `6` | Yes | | `7` | No | [Example](https://docs.volt.bz/docs/miscellaneous/messagebox#example) ---------------------------------------------------------------------- -- Simple message messagebox("Hello!", "Greeting", 0) -- Confirmation dialog local result = messagebox("Are you sure?", "Confirm", 4 + 32) if result == 6 then print("User clicked Yes") else print("User clicked No") end -- Warning message messagebox("Something went wrong!", "Warning", 0 + 48) [Notes](https://docs.volt.bz/docs/miscellaneous/messagebox#notes) ------------------------------------------------------------------ * Flags can be combined with addition * This is a yielding function [identifyexecutor\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/identifyexecutor) [queueonteleport\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/queueonteleport) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/messagebox#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/messagebox#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/messagebox#returns) [Description](https://docs.volt.bz/docs/miscellaneous/messagebox#description) [Common Flags](https://docs.volt.bz/docs/miscellaneous/messagebox#common-flags) [Return Values](https://docs.volt.bz/docs/miscellaneous/messagebox#return-values) [Example](https://docs.volt.bz/docs/miscellaneous/messagebox#example) [Notes](https://docs.volt.bz/docs/miscellaneous/messagebox#notes) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getscriptclosure ================ Gets the main function of a script. [Syntax](https://docs.volt.bz/docs/scripts/getscriptclosure#syntax) -------------------------------------------------------------------- getscriptclosure(script: LocalScript | ModuleScript) -> function [Parameters](https://docs.volt.bz/docs/scripts/getscriptclosure#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `script` | `LocalScript` or `ModuleScript` | The script | [Returns](https://docs.volt.bz/docs/scripts/getscriptclosure#returns) ---------------------------------------------------------------------- | Type | Description | | --- | --- | | `function` | The script's main function | [Description](https://docs.volt.bz/docs/scripts/getscriptclosure#description) ------------------------------------------------------------------------------ `getscriptclosure` returns the main function (closure) of a script. For ModuleScripts, this is the function that would be returned by `require()`. [Example](https://docs.volt.bz/docs/scripts/getscriptclosure#example) ---------------------------------------------------------------------- local scripts = getrunningscripts() if #scripts > 0 then local closure = getscriptclosure(scripts[1]) print("Got closure:", closure) -- Inspect the function local constants = debug.getconstants(closure) print("Constants:", #constants) end [Accessing Module Functions](https://docs.volt.bz/docs/scripts/getscriptclosure#accessing-module-functions) ------------------------------------------------------------------------------------------------------------ local modules = getloadedmodules() for _, module in ipairs(modules) do local closure = getscriptclosure(module) -- Get module's protos (inner functions) local protos = debug.getprotos(closure) print(module.Name, "has", #protos, "inner functions") end [Related Functions](https://docs.volt.bz/docs/scripts/getscriptclosure#related-functions) ------------------------------------------------------------------------------------------ * [`getscriptbytecode`](https://docs.volt.bz/docs/scripts/getscriptbytecode) - Get bytecode * [`getsenv`](https://docs.volt.bz/docs/scripts/getsenv) - Get script environment [Aliases](https://docs.volt.bz/docs/scripts/getscriptclosure#aliases) ---------------------------------------------------------------------- * `getscriptfunction` [getscriptbytecode\ \ Previous Page](https://docs.volt.bz/docs/scripts/getscriptbytecode) [getscriptfromthread\ \ Next Page](https://docs.volt.bz/docs/scripts/getscriptfromthread) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getscriptclosure#syntax) [Parameters](https://docs.volt.bz/docs/scripts/getscriptclosure#parameters) [Returns](https://docs.volt.bz/docs/scripts/getscriptclosure#returns) [Description](https://docs.volt.bz/docs/scripts/getscriptclosure#description) [Example](https://docs.volt.bz/docs/scripts/getscriptclosure#example) [Accessing Module Functions](https://docs.volt.bz/docs/scripts/getscriptclosure#accessing-module-functions) [Related Functions](https://docs.volt.bz/docs/scripts/getscriptclosure#related-functions) [Aliases](https://docs.volt.bz/docs/scripts/getscriptclosure#aliases) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.validlevel ================ Checks if a stack level is valid. [Syntax](https://docs.volt.bz/docs/debug/validlevel#syntax) ------------------------------------------------------------ debug.validlevel(level: number) -> boolean [Aliases](https://docs.volt.bz/docs/debug/validlevel#aliases) -------------------------------------------------------------- * `debug.isvalidlevel` [Parameters](https://docs.volt.bz/docs/debug/validlevel#parameters) -------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `level` | `number` | The stack level | [Returns](https://docs.volt.bz/docs/debug/validlevel#returns) -------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if the stack level is valid | [Description](https://docs.volt.bz/docs/debug/validlevel#description) ---------------------------------------------------------------------- `debug.validlevel` checks whether a given stack level exists and is valid for debugging operations. [Example](https://docs.volt.bz/docs/debug/validlevel#example) -------------------------------------------------------------- -- Check stack levels for i = 0, 10 do if debug.validlevel(i) then print("Level " .. i .. " is valid") else print("Level " .. i .. " is invalid") break end end [Related Functions](https://docs.volt.bz/docs/debug/validlevel#related-functions) ---------------------------------------------------------------------------------- * [`debug.getinfo`](https://docs.volt.bz/docs/debug/getinfo) - Get function info * [`debug.getcallstack`](https://docs.volt.bz/docs/debug/getcallstack) - Get call stack [debug.setupvalue\ \ Previous Page](https://docs.volt.bz/docs/debug/setupvalue) [Drawing\ \ Next Page](https://docs.volt.bz/docs/drawing) ### On this page [Syntax](https://docs.volt.bz/docs/debug/validlevel#syntax) [Aliases](https://docs.volt.bz/docs/debug/validlevel#aliases) [Parameters](https://docs.volt.bz/docs/debug/validlevel#parameters) [Returns](https://docs.volt.bz/docs/debug/validlevel#returns) [Description](https://docs.volt.bz/docs/debug/validlevel#description) [Example](https://docs.volt.bz/docs/debug/validlevel#example) [Related Functions](https://docs.volt.bz/docs/debug/validlevel#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse1release ============= Simulates releasing the left mouse button. [Syntax](https://docs.volt.bz/docs/input/mouse1release#syntax) --------------------------------------------------------------- mouse1release() -> void [Returns](https://docs.volt.bz/docs/input/mouse1release#returns) ----------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse1release#description) ------------------------------------------------------------------------- `mouse1release` simulates releasing the left mouse button that was pressed with `mouse1press`. [Example](https://docs.volt.bz/docs/input/mouse1release#example) ----------------------------------------------------------------- mouse1press() task.wait(0.5) mouse1release() [Related Functions](https://docs.volt.bz/docs/input/mouse1release#related-functions) ------------------------------------------------------------------------------------- * [`mouse1press`](https://docs.volt.bz/docs/input/mouse1press) - Press left mouse * [`mouse1click`](https://docs.volt.bz/docs/input/mouse1click) - Click left mouse [mouse1press\ \ Previous Page](https://docs.volt.bz/docs/input/mouse1press) [mouse2click\ \ Next Page](https://docs.volt.bz/docs/input/mouse2click) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse1release#syntax) [Returns](https://docs.volt.bz/docs/input/mouse1release#returns) [Description](https://docs.volt.bz/docs/input/mouse1release#description) [Example](https://docs.volt.bz/docs/input/mouse1release#example) [Related Functions](https://docs.volt.bz/docs/input/mouse1release#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) identifyexecutor ================ Returns information about volt. [Syntax](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#syntax) -------------------------------------------------------------------------- identifyexecutor() -> string, string [Returns](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#returns) ---------------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | Volt | | `string` | Version | [Description](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#description) ------------------------------------------------------------------------------------ `identifyexecutor` returns the name and version of volt. [Example](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#example) ---------------------------------------------------------------------------- local name, version = identifyexecutor() print("Name:", name) print("Version:", version) -- Example output: -- Name: Volt -- Version: 1.0.0.0 [Aliases](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#aliases) ---------------------------------------------------------------------------- * `getexecutorname` [gethwid\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/gethwid) [messagebox\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/messagebox) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#syntax) [Returns](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#returns) [Description](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#description) [Example](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#example) [Aliases](https://docs.volt.bz/docs/miscellaneous/identifyexecutor#aliases) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getscriptfromthread =================== Gets the script associated with a thread. [Syntax](https://docs.volt.bz/docs/scripts/getscriptfromthread#syntax) ----------------------------------------------------------------------- getscriptfromthread(thread: thread) -> LuaSourceContainer? [Parameters](https://docs.volt.bz/docs/scripts/getscriptfromthread#parameters) ------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `thread` | `thread` | The thread to check | [Returns](https://docs.volt.bz/docs/scripts/getscriptfromthread#returns) ------------------------------------------------------------------------- | Type | Description | | --- | --- | | `LuaSourceContainer?` | The script, or nil if none associated | [Description](https://docs.volt.bz/docs/scripts/getscriptfromthread#description) --------------------------------------------------------------------------------- `getscriptfromthread` returns the script (LocalScript, ModuleScript, or Script) that is running in the specified thread. [Example](https://docs.volt.bz/docs/scripts/getscriptfromthread#example) ------------------------------------------------------------------------- local script = getscriptfromthread(coroutine.running()) if script then print("Current script:", script:GetFullName()) end -- Check what script a connection is from local connection connection = game:GetService("RunService").Heartbeat:Connect(function() local thread = coroutine.running() local scriptSource = getscriptfromthread(thread) if scriptSource then print("Heartbeat from:", scriptSource.Name) end connection:Disconnect() end) [Related Functions](https://docs.volt.bz/docs/scripts/getscriptfromthread#related-functions) --------------------------------------------------------------------------------------------- * [`getcallingscript`](https://docs.volt.bz/docs/scripts/getcallingscript) - Get calling script * [`getrunningscripts`](https://docs.volt.bz/docs/scripts/getrunningscripts) - Get all running scripts [getscriptclosure\ \ Previous Page](https://docs.volt.bz/docs/scripts/getscriptclosure) [getscripthash\ \ Next Page](https://docs.volt.bz/docs/scripts/getscripthash) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getscriptfromthread#syntax) [Parameters](https://docs.volt.bz/docs/scripts/getscriptfromthread#parameters) [Returns](https://docs.volt.bz/docs/scripts/getscriptfromthread#returns) [Description](https://docs.volt.bz/docs/scripts/getscriptfromthread#description) [Example](https://docs.volt.bz/docs/scripts/getscriptfromthread#example) [Related Functions](https://docs.volt.bz/docs/scripts/getscriptfromthread#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) getinstances ============ Returns all instances in the game. [Syntax](https://docs.volt.bz/docs/instances/getinstances#syntax) ------------------------------------------------------------------ getinstances() -> table [Returns](https://docs.volt.bz/docs/instances/getinstances#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of all instances | [Description](https://docs.volt.bz/docs/instances/getinstances#description) ---------------------------------------------------------------------------- `getinstances` returns a table containing every instance currently in the game, including those not in the DataModel hierarchy. [Example](https://docs.volt.bz/docs/instances/getinstances#example) -------------------------------------------------------------------- local instances = getinstances() print("Total instances:", #instances) -- Count by class local counts = {} for _, inst in ipairs(instances) do local class = inst.ClassName counts[class] = (counts[class] or 0) + 1 end for class, count in pairs(counts) do print(class, count) end [Finding Specific Instances](https://docs.volt.bz/docs/instances/getinstances#finding-specific-instances) ---------------------------------------------------------------------------------------------------------- -- Find all Scripts local scripts = {} for _, inst in ipairs(getinstances()) do if inst:IsA("Script") then table.insert(scripts, inst) end end [Notes](https://docs.volt.bz/docs/instances/getinstances#notes) ---------------------------------------------------------------- * Returns a very large table * Includes nil-parented instances * May impact performance if called frequently [Related Functions](https://docs.volt.bz/docs/instances/getinstances#related-functions) ---------------------------------------------------------------------------------------- * [`getnilinstances`](https://docs.volt.bz/docs/instances/getnilinstances) - Get only nil-parented instances [getinstancecache\ \ Previous Page](https://docs.volt.bz/docs/instances/getinstancecache) [getnilinstances\ \ Next Page](https://docs.volt.bz/docs/instances/getnilinstances) ### On this page [Syntax](https://docs.volt.bz/docs/instances/getinstances#syntax) [Returns](https://docs.volt.bz/docs/instances/getinstances#returns) [Description](https://docs.volt.bz/docs/instances/getinstances#description) [Example](https://docs.volt.bz/docs/instances/getinstances#example) [Finding Specific Instances](https://docs.volt.bz/docs/instances/getinstances#finding-specific-instances) [Notes](https://docs.volt.bz/docs/instances/getinstances#notes) [Related Functions](https://docs.volt.bz/docs/instances/getinstances#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) getnilinstances =============== Returns all instances with nil parent. [Syntax](https://docs.volt.bz/docs/instances/getnilinstances#syntax) --------------------------------------------------------------------- getnilinstances() -> table [Returns](https://docs.volt.bz/docs/instances/getnilinstances#returns) ----------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of nil-parented instances | [Description](https://docs.volt.bz/docs/instances/getnilinstances#description) ------------------------------------------------------------------------------- `getnilinstances` returns all instances that have their Parent set to nil. These instances exist in memory but aren't part of the game hierarchy. [Example](https://docs.volt.bz/docs/instances/getnilinstances#example) ----------------------------------------------------------------------- local nilInstances = getnilinstances() print("Nil instances:", #nilInstances) for _, inst in ipairs(nilInstances) do print(inst.ClassName, inst.Name) end [Finding Hidden Scripts](https://docs.volt.bz/docs/instances/getnilinstances#finding-hidden-scripts) ----------------------------------------------------------------------------------------------------- -- Scripts are sometimes hidden by setting parent to nil local hiddenScripts = {} for _, inst in ipairs(getnilinstances()) do if inst:IsA("LocalScript") or inst:IsA("ModuleScript") then table.insert(hiddenScripts, inst) end end print("Found", #hiddenScripts, "hidden scripts") [Use Cases](https://docs.volt.bz/docs/instances/getnilinstances#use-cases) --------------------------------------------------------------------------- * **Finding hidden instances**: Locate instances games try to hide * **Script discovery**: Find scripts that were parented to nil * **Memory inspection**: See what's being kept in memory [Related Functions](https://docs.volt.bz/docs/instances/getnilinstances#related-functions) ------------------------------------------------------------------------------------------- * [`getinstances`](https://docs.volt.bz/docs/instances/getinstances) - Get all instances [getinstances\ \ Previous Page](https://docs.volt.bz/docs/instances/getinstances) [getrendersteppedlist\ \ Next Page](https://docs.volt.bz/docs/instances/getrendersteppedlist) ### On this page [Syntax](https://docs.volt.bz/docs/instances/getnilinstances#syntax) [Returns](https://docs.volt.bz/docs/instances/getnilinstances#returns) [Description](https://docs.volt.bz/docs/instances/getnilinstances#description) [Example](https://docs.volt.bz/docs/instances/getnilinstances#example) [Finding Hidden Scripts](https://docs.volt.bz/docs/instances/getnilinstances#finding-hidden-scripts) [Use Cases](https://docs.volt.bz/docs/instances/getnilinstances#use-cases) [Related Functions](https://docs.volt.bz/docs/instances/getnilinstances#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) islclosure ========== Checks if a function is a Luau closure. [Syntax](https://docs.volt.bz/docs/closures/islclosure#syntax) --------------------------------------------------------------- islclosure(func: function) -> boolean [Parameters](https://docs.volt.bz/docs/closures/islclosure#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to check | [Returns](https://docs.volt.bz/docs/closures/islclosure#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | `true` if the function is a Luau closure, `false` otherwise | [Description](https://docs.volt.bz/docs/closures/islclosure#description) ------------------------------------------------------------------------- `islclosure` returns whether the given function is written in Luau rather than C/C++. Luau closures include user-defined functions and script functions. [Example](https://docs.volt.bz/docs/closures/islclosure#example) ----------------------------------------------------------------- -- User-defined functions are Luau closures local function myFunc() return "hello" end print(islclosure(myFunc)) -- true -- Built-in functions are NOT Luau closures print(islclosure(print)) -- false print(islclosure(type)) -- false -- Wrapped functions are NOT Luau closures local wrapped = newcclosure(myFunc) print(islclosure(wrapped)) -- false [Relationship with iscclosure](https://docs.volt.bz/docs/closures/islclosure#relationship-with-iscclosure) ----------------------------------------------------------------------------------------------------------- `islclosure` is the logical opposite of `iscclosure`: local function test() end print(islclosure(test)) -- true print(iscclosure(test)) -- false print(islclosure(test) == not iscclosure(test)) -- true [Related Functions](https://docs.volt.bz/docs/closures/islclosure#related-functions) ------------------------------------------------------------------------------------- * [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) - Check if a function is a C closure * [`newcclosure`](https://docs.volt.bz/docs/closures/newcclosure) - Convert a Luau closure to a C closure [isfunctionhooked\ \ Previous Page](https://docs.volt.bz/docs/closures/isfunctionhooked) [isnewcclosure\ \ Next Page](https://docs.volt.bz/docs/closures/isnewcclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/islclosure#syntax) [Parameters](https://docs.volt.bz/docs/closures/islclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/islclosure#returns) [Description](https://docs.volt.bz/docs/closures/islclosure#description) [Example](https://docs.volt.bz/docs/closures/islclosure#example) [Relationship with iscclosure](https://docs.volt.bz/docs/closures/islclosure#relationship-with-iscclosure) [Related Functions](https://docs.volt.bz/docs/closures/islclosure#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) isnewcclosure ============= Checks if a function is a newcclosure wrapper. [Syntax](https://docs.volt.bz/docs/closures/isnewcclosure#syntax) ------------------------------------------------------------------ isnewcclosure(func: function) -> boolean [Aliases](https://docs.volt.bz/docs/closures/isnewcclosure#aliases) -------------------------------------------------------------------- * `iscustomcclosure` [Parameters](https://docs.volt.bz/docs/closures/isnewcclosure#parameters) -------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The function to check | [Returns](https://docs.volt.bz/docs/closures/isnewcclosure#returns) -------------------------------------------------------------------- | Type | Description | | --- | --- | | `boolean` | True if function was created by newcclosure | [Description](https://docs.volt.bz/docs/closures/isnewcclosure#description) ---------------------------------------------------------------------------- `isnewcclosure` checks whether a function was wrapped using `newcclosure`. [Example](https://docs.volt.bz/docs/closures/isnewcclosure#example) -------------------------------------------------------------------- local function luaFunc() return "lua" end local wrapped = newcclosure(luaFunc) print(isnewcclosure(luaFunc)) -- false print(isnewcclosure(wrapped)) -- true print(isnewcclosure(print)) -- false (native C closure) [Notes](https://docs.volt.bz/docs/closures/isnewcclosure#notes) ---------------------------------------------------------------- * Useful for distinguishing between native C closures and wrapped functions * Returns false for native C closures like `print` [Related Functions](https://docs.volt.bz/docs/closures/isnewcclosure#related-functions) ---------------------------------------------------------------------------------------- * [`newcclosure`](https://docs.volt.bz/docs/closures/newcclosure) - Wrap as C closure * [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) - Check if C closure * [`islclosure`](https://docs.volt.bz/docs/closures/islclosure) - Check if Luau closure [islclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/islclosure) [newcclosure\ \ Next Page](https://docs.volt.bz/docs/closures/newcclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/isnewcclosure#syntax) [Aliases](https://docs.volt.bz/docs/closures/isnewcclosure#aliases) [Parameters](https://docs.volt.bz/docs/closures/isnewcclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/isnewcclosure#returns) [Description](https://docs.volt.bz/docs/closures/isnewcclosure#description) [Example](https://docs.volt.bz/docs/closures/isnewcclosure#example) [Notes](https://docs.volt.bz/docs/closures/isnewcclosure#notes) [Related Functions](https://docs.volt.bz/docs/closures/isnewcclosure#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getupvalue ================ Gets an upvalue from a function by index. [Syntax](https://docs.volt.bz/docs/debug/getupvalue#syntax) ------------------------------------------------------------ debug.getupvalue(func: function | number, index: number) -> any [Parameters](https://docs.volt.bz/docs/debug/getupvalue#parameters) -------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | | `index` | `number` | The upvalue index (1-based) | [Returns](https://docs.volt.bz/docs/debug/getupvalue#returns) -------------------------------------------------------------- | Type | Description | | --- | --- | | `any` | The upvalue at the specified index | [Description](https://docs.volt.bz/docs/debug/getupvalue#description) ---------------------------------------------------------------------- `debug.getupvalue` retrieves an upvalue (captured variable from an outer scope) from a function. Upvalues are variables that a closure "closes over" from its enclosing environment. [Example](https://docs.volt.bz/docs/debug/getupvalue#example) -------------------------------------------------------------- local counter = 0 local prefix = "Count: " local function increment() counter = counter + 1 return prefix .. counter end -- Get the upvalues print(debug.getupvalue(increment, 1)) -- 0 (counter) print(debug.getupvalue(increment, 2)) -- "Count: " (prefix) -- After calling the function increment() print(debug.getupvalue(increment, 1)) -- 1 (counter was modified) [Use Cases](https://docs.volt.bz/docs/debug/getupvalue#use-cases) ------------------------------------------------------------------ * **Inspect closures**: See what variables a function has captured * **Debugging**: Examine the state of captured variables * **Modification**: Read before modifying with `setupvalue` [Related Functions](https://docs.volt.bz/docs/debug/getupvalue#related-functions) ---------------------------------------------------------------------------------- * [`debug.getupvalues`](https://docs.volt.bz/docs/debug/getupvalues) - Get all upvalues * [`debug.setupvalue`](https://docs.volt.bz/docs/debug/setupvalue) - Modify an upvalue [debug.getstack\ \ Previous Page](https://docs.volt.bz/docs/debug/getstack) [debug.getupvalues\ \ Next Page](https://docs.volt.bz/docs/debug/getupvalues) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getupvalue#syntax) [Parameters](https://docs.volt.bz/docs/debug/getupvalue#parameters) [Returns](https://docs.volt.bz/docs/debug/getupvalue#returns) [Description](https://docs.volt.bz/docs/debug/getupvalue#description) [Example](https://docs.volt.bz/docs/debug/getupvalue#example) [Use Cases](https://docs.volt.bz/docs/debug/getupvalue#use-cases) [Related Functions](https://docs.volt.bz/docs/debug/getupvalue#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoleshow ============ Creates and shows the console window. [Syntax](https://docs.volt.bz/docs/console/rconsoleshow#syntax) ---------------------------------------------------------------- rconsoleshow() -> void [Aliases](https://docs.volt.bz/docs/console/rconsoleshow#aliases) ------------------------------------------------------------------ * `rconsolecreate` * `consolecreate` [Returns](https://docs.volt.bz/docs/console/rconsoleshow#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoleshow#description) -------------------------------------------------------------------------- `rconsoleshow` creates a new console window if one doesn't exist, and shows it. The console can be used to display output and receive user input. [Example](https://docs.volt.bz/docs/console/rconsoleshow#example) ------------------------------------------------------------------ -- Create and show the console rconsoleshow() -- Print a welcome message rconsoleprint("Welcome to the console!\n") -- Set a custom title rconsolename("My Script Console") [Notes](https://docs.volt.bz/docs/console/rconsoleshow#notes) -------------------------------------------------------------- * Only one console window can exist at a time * The console persists until `rconsolehide` is called or the game closes * Use `\n` for newlines in console output [Related Functions](https://docs.volt.bz/docs/console/rconsoleshow#related-functions) -------------------------------------------------------------------------------------- * [`rconsolehide`](https://docs.volt.bz/docs/console/rconsolehide) - Hide the console * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print to console * [`rconsolename`](https://docs.volt.bz/docs/console/rconsolename) - Set console title [rconsoleprint\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleprint) [rconsoletoggle\ \ Next Page](https://docs.volt.bz/docs/console/rconsoletoggle) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoleshow#syntax) [Aliases](https://docs.volt.bz/docs/console/rconsoleshow#aliases) [Returns](https://docs.volt.bz/docs/console/rconsoleshow#returns) [Description](https://docs.volt.bz/docs/console/rconsoleshow#description) [Example](https://docs.volt.bz/docs/console/rconsoleshow#example) [Notes](https://docs.volt.bz/docs/console/rconsoleshow#notes) [Related Functions](https://docs.volt.bz/docs/console/rconsoleshow#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) listfiles ========= Lists all files and folders in a directory. [Syntax](https://docs.volt.bz/docs/filesystem/listfiles#syntax) ---------------------------------------------------------------- listfiles(path: string) -> table [Parameters](https://docs.volt.bz/docs/filesystem/listfiles#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The folder path | [Returns](https://docs.volt.bz/docs/filesystem/listfiles#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `table` | Array of file and folder paths | [Description](https://docs.volt.bz/docs/filesystem/listfiles#description) -------------------------------------------------------------------------- `listfiles` returns a table containing the paths of all files and folders within the specified directory. [Example](https://docs.volt.bz/docs/filesystem/listfiles#example) ------------------------------------------------------------------ -- Create some files and folders makefolder("mydata") writefile("mydata/file1.txt", "Hello") writefile("mydata/file2.txt", "World") makefolder("mydata/subfolder") -- List contents local files = listfiles("mydata") for _, path in ipairs(files) do print(path) end --[[\ mydata/file1.txt\ mydata/file2.txt\ mydata/subfolder\ ]] [Filtering Files and Folders](https://docs.volt.bz/docs/filesystem/listfiles#filtering-files-and-folders) ---------------------------------------------------------------------------------------------------------- local function getFiles(path) local files = {} for _, item in ipairs(listfiles(path)) do if isfile(item) then table.insert(files, item) end end return files end local function getFolders(path) local folders = {} for _, item in ipairs(listfiles(path)) do if isfolder(item) then table.insert(folders, item) end end return folders end [Recursive Listing](https://docs.volt.bz/docs/filesystem/listfiles#recursive-listing) -------------------------------------------------------------------------------------- local function listAllFiles(path, results) results = results or {} for _, item in ipairs(listfiles(path)) do if isfile(item) then table.insert(results, item) elseif isfolder(item) then listAllFiles(item, results) end end return results end local allFiles = listAllFiles("mydata") [Related Functions](https://docs.volt.bz/docs/filesystem/listfiles#related-functions) -------------------------------------------------------------------------------------- * [`isfile`](https://docs.volt.bz/docs/filesystem/isfile) - Check if path is a file * [`isfolder`](https://docs.volt.bz/docs/filesystem/isfolder) - Check if path is a folder [isfolder\ \ Previous Page](https://docs.volt.bz/docs/filesystem/isfolder) [loadfile\ \ Next Page](https://docs.volt.bz/docs/filesystem/loadfile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/listfiles#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/listfiles#parameters) [Returns](https://docs.volt.bz/docs/filesystem/listfiles#returns) [Description](https://docs.volt.bz/docs/filesystem/listfiles#description) [Example](https://docs.volt.bz/docs/filesystem/listfiles#example) [Filtering Files and Folders](https://docs.volt.bz/docs/filesystem/listfiles#filtering-files-and-folders) [Recursive Listing](https://docs.volt.bz/docs/filesystem/listfiles#recursive-listing) [Related Functions](https://docs.volt.bz/docs/filesystem/listfiles#related-functions) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) loadstring ========== Compiles a string of Lua code and returns it as a function. [Syntax](https://docs.volt.bz/docs/scripts/loadstring#syntax) -------------------------------------------------------------- loadstring(code: string, chunkname?: string) -> function?, string? [Parameters](https://docs.volt.bz/docs/scripts/loadstring#parameters) ---------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `code` | `string` | The Lua source code | | `chunkname` | `string?` | Optional name for error messages | [Returns](https://docs.volt.bz/docs/scripts/loadstring#returns) ---------------------------------------------------------------- | Type | Description | | --- | --- | | `function?` | The compiled function, or nil on error | | `string?` | Error message if compilation failed | [Description](https://docs.volt.bz/docs/scripts/loadstring#description) ------------------------------------------------------------------------ `loadstring` compiles Lua source code into a callable function. This is essential for dynamic code execution. [Example](https://docs.volt.bz/docs/scripts/loadstring#example) ---------------------------------------------------------------- local code = [[\ local message = "Hello from loadstring!"\ print(message)\ return 42\ ]] local func, err = loadstring(code) if func then local result = func() print("Returned:", result) -- 42 else warn("Compile error:", err) end [Loading from URL](https://docs.volt.bz/docs/scripts/loadstring#loading-from-url) ---------------------------------------------------------------------------------- local code = game:HttpGet("https://example.com/script.lua") local func, err = loadstring(code) if func then func() end [With Error Handling](https://docs.volt.bz/docs/scripts/loadstring#with-error-handling) ---------------------------------------------------------------------------------------- local function safeLoadstring(code) local func, compileErr = loadstring(code) if not func then return nil, "Compile error: " .. tostring(compileErr) end local success, result = pcall(func) if not success then return nil, "Runtime error: " .. tostring(result) end return result end local result, err = safeLoadstring("return 1 + 1") if result then print("Result:", result) else warn(err) end [Named Chunks](https://docs.volt.bz/docs/scripts/loadstring#named-chunks) -------------------------------------------------------------------------- -- Provide a name for better error messages local func = loadstring("error('test')", "MyScript") func() -- Error will reference "MyScript" [Notes](https://docs.volt.bz/docs/scripts/loadstring#notes) ------------------------------------------------------------ * Roblox normally disables `loadstring` for security * Volt re-enable this functionality * Always validate and sanitize code from external sources [getsenv\ \ Previous Page](https://docs.volt.bz/docs/scripts/getsenv) [Signals\ \ Next Page](https://docs.volt.bz/docs/signals) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/loadstring#syntax) [Parameters](https://docs.volt.bz/docs/scripts/loadstring#parameters) [Returns](https://docs.volt.bz/docs/scripts/loadstring#returns) [Description](https://docs.volt.bz/docs/scripts/loadstring#description) [Example](https://docs.volt.bz/docs/scripts/loadstring#example) [Loading from URL](https://docs.volt.bz/docs/scripts/loadstring#loading-from-url) [With Error Handling](https://docs.volt.bz/docs/scripts/loadstring#with-error-handling) [Named Chunks](https://docs.volt.bz/docs/scripts/loadstring#named-chunks) [Notes](https://docs.volt.bz/docs/scripts/loadstring#notes) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) getrendersteppedlist ==================== Gets all RenderStepped connections. [Syntax](https://docs.volt.bz/docs/instances/getrendersteppedlist#syntax) -------------------------------------------------------------------------- getrendersteppedlist() -> table [Returns](https://docs.volt.bz/docs/instances/getrendersteppedlist#returns) ---------------------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | Array of RenderStepped connections | [Description](https://docs.volt.bz/docs/instances/getrendersteppedlist#description) ------------------------------------------------------------------------------------ `getrendersteppedlist` returns all active connections to the RenderStepped event. [Example](https://docs.volt.bz/docs/instances/getrendersteppedlist#example) ---------------------------------------------------------------------------- local connections = getrendersteppedlist() print("RenderStepped connections:", #connections) for _, connection in ipairs(connections) do print("Connected:", connection.Function) end [Related Functions](https://docs.volt.bz/docs/instances/getrendersteppedlist#related-functions) ------------------------------------------------------------------------------------------------ * [`getconnections`](https://docs.volt.bz/docs/signals/getconnections) - Get connections for any signal [getnilinstances\ \ Previous Page](https://docs.volt.bz/docs/instances/getnilinstances) [LuaStateProxy\ \ Next Page](https://docs.volt.bz/docs/luastateproxy) ### On this page [Syntax](https://docs.volt.bz/docs/instances/getrendersteppedlist#syntax) [Returns](https://docs.volt.bz/docs/instances/getrendersteppedlist#returns) [Description](https://docs.volt.bz/docs/instances/getrendersteppedlist#description) [Example](https://docs.volt.bz/docs/instances/getrendersteppedlist#example) [Related Functions](https://docs.volt.bz/docs/instances/getrendersteppedlist#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoletoggle ============== Toggles the console window visibility. [Syntax](https://docs.volt.bz/docs/console/rconsoletoggle#syntax) ------------------------------------------------------------------ rconsoletoggle() -> void [Returns](https://docs.volt.bz/docs/console/rconsoletoggle#returns) -------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoletoggle#description) ---------------------------------------------------------------------------- `rconsoletoggle` toggles the visibility of the console window. If hidden, it shows the console; if visible, it hides the console. [Example](https://docs.volt.bz/docs/console/rconsoletoggle#example) -------------------------------------------------------------------- -- Create console first rconsoleshow() rconsoleprint("Console is visible\n") -- Toggle it off rconsoletoggle() print("Console is now hidden") -- Toggle it back on rconsoletoggle() rconsoleprint("Console is visible again\n") [Related Functions](https://docs.volt.bz/docs/console/rconsoletoggle#related-functions) ---------------------------------------------------------------------------------------- * [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) - Show the console * [`rconsolehide`](https://docs.volt.bz/docs/console/rconsolehide) - Hide the console * [`rconsolehidden`](https://docs.volt.bz/docs/console/rconsolehidden) - Check if hidden [rconsoleshow\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoleshow) [rconsoletop\ \ Next Page](https://docs.volt.bz/docs/console/rconsoletop) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoletoggle#syntax) [Returns](https://docs.volt.bz/docs/console/rconsoletoggle#returns) [Description](https://docs.volt.bz/docs/console/rconsoletoggle#description) [Example](https://docs.volt.bz/docs/console/rconsoletoggle#example) [Related Functions](https://docs.volt.bz/docs/console/rconsoletoggle#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) makefolder ========== Creates a new folder. [Syntax](https://docs.volt.bz/docs/filesystem/makefolder#syntax) ----------------------------------------------------------------- makefolder(path: string) -> void [Parameters](https://docs.volt.bz/docs/filesystem/makefolder#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The folder path to create | [Returns](https://docs.volt.bz/docs/filesystem/makefolder#returns) ------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/filesystem/makefolder#description) --------------------------------------------------------------------------- `makefolder` creates a new folder at the specified path. Parent folders are created automatically if they don't exist. [Example](https://docs.volt.bz/docs/filesystem/makefolder#example) ------------------------------------------------------------------- -- Create a simple folder makefolder("configs") -- Create nested folders makefolder("data/saves/player1") -- Verify they exist print(isfolder("configs")) -- true print(isfolder("data/saves/player1")) -- true [Ensure Folder Exists](https://docs.volt.bz/docs/filesystem/makefolder#ensure-folder-exists) --------------------------------------------------------------------------------------------- local function ensureFolder(path) if not isfolder(path) then makefolder(path) return true -- Created end return false -- Already existed end if ensureFolder("logs") then print("Created logs folder") end [Related Functions](https://docs.volt.bz/docs/filesystem/makefolder#related-functions) --------------------------------------------------------------------------------------- * [`isfolder`](https://docs.volt.bz/docs/filesystem/isfolder) - Check if folder exists * [`delfolder`](https://docs.volt.bz/docs/filesystem/delfolder) - Delete a folder * [`listfiles`](https://docs.volt.bz/docs/filesystem/listfiles) - List folder contents [loadfile\ \ Previous Page](https://docs.volt.bz/docs/filesystem/loadfile) [readfile\ \ Next Page](https://docs.volt.bz/docs/filesystem/readfile) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/makefolder#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/makefolder#parameters) [Returns](https://docs.volt.bz/docs/filesystem/makefolder#returns) [Description](https://docs.volt.bz/docs/filesystem/makefolder#description) [Example](https://docs.volt.bz/docs/filesystem/makefolder#example) [Ensure Folder Exists](https://docs.volt.bz/docs/filesystem/makefolder#ensure-folder-exists) [Related Functions](https://docs.volt.bz/docs/filesystem/makefolder#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsoletop =========== Brings the console window to the front. [Syntax](https://docs.volt.bz/docs/console/rconsoletop#syntax) --------------------------------------------------------------- rconsoletop() -> void [Returns](https://docs.volt.bz/docs/console/rconsoletop#returns) ----------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsoletop#description) ------------------------------------------------------------------------- `rconsoletop` brings the console window to the front of all other windows, making it the topmost window. [Example](https://docs.volt.bz/docs/console/rconsoletop#example) ----------------------------------------------------------------- rconsoleshow() rconsoleprint("This console is now on top!\n") -- Bring console to front rconsoletop() [Notes](https://docs.volt.bz/docs/console/rconsoletop#notes) ------------------------------------------------------------- * Useful when the console gets hidden behind other windows * Has no effect if the console is hidden [Related Functions](https://docs.volt.bz/docs/console/rconsoletop#related-functions) ------------------------------------------------------------------------------------- * [`rconsoleshow`](https://docs.volt.bz/docs/console/rconsoleshow) - Show the console [rconsoletoggle\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoletoggle) [rconsolewarn\ \ Next Page](https://docs.volt.bz/docs/console/rconsolewarn) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsoletop#syntax) [Returns](https://docs.volt.bz/docs/console/rconsoletop#returns) [Description](https://docs.volt.bz/docs/console/rconsoletop#description) [Example](https://docs.volt.bz/docs/console/rconsoletop#example) [Notes](https://docs.volt.bz/docs/console/rconsoletop#notes) [Related Functions](https://docs.volt.bz/docs/console/rconsoletop#related-functions) --- # Volt Documentation [Console](https://docs.volt.bz/docs/console) rconsolewarn ============ Prints a warning message to the console. [Syntax](https://docs.volt.bz/docs/console/rconsolewarn#syntax) ---------------------------------------------------------------- rconsolewarn(text: string) -> void [Parameters](https://docs.volt.bz/docs/console/rconsolewarn#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `text` | `string` | The warning message | [Returns](https://docs.volt.bz/docs/console/rconsolewarn#returns) ------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/console/rconsolewarn#description) -------------------------------------------------------------------------- `rconsolewarn` prints a warning-level message to the console, typically displayed in yellow or with a warning prefix. [Example](https://docs.volt.bz/docs/console/rconsolewarn#example) ------------------------------------------------------------------ rconsoleshow() rconsolewarn("Config file not found, using defaults") rconsolewarn("Low memory detected") [Related Functions](https://docs.volt.bz/docs/console/rconsolewarn#related-functions) -------------------------------------------------------------------------------------- * [`rconsoleprint`](https://docs.volt.bz/docs/console/rconsoleprint) - Print plain text * [`rconsoleinfo`](https://docs.volt.bz/docs/console/rconsoleinfo) - Print info * [`rconsoleerr`](https://docs.volt.bz/docs/console/rconsoleerr) - Print error [rconsoletop\ \ Previous Page](https://docs.volt.bz/docs/console/rconsoletop) [Crypt\ \ Next Page](https://docs.volt.bz/docs/crypt) ### On this page [Syntax](https://docs.volt.bz/docs/console/rconsolewarn#syntax) [Parameters](https://docs.volt.bz/docs/console/rconsolewarn#parameters) [Returns](https://docs.volt.bz/docs/console/rconsolewarn#returns) [Description](https://docs.volt.bz/docs/console/rconsolewarn#description) [Example](https://docs.volt.bz/docs/console/rconsolewarn#example) [Related Functions](https://docs.volt.bz/docs/console/rconsolewarn#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse2click =========== Simulates a right mouse click. [Syntax](https://docs.volt.bz/docs/input/mouse2click#syntax) ------------------------------------------------------------- mouse2click() -> void [Returns](https://docs.volt.bz/docs/input/mouse2click#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse2click#description) ----------------------------------------------------------------------- `mouse2click` simulates a complete right mouse button click (press and release). [Example](https://docs.volt.bz/docs/input/mouse2click#example) --------------------------------------------------------------- -- Right click to open context menu mouse2click() [Related Functions](https://docs.volt.bz/docs/input/mouse2click#related-functions) ----------------------------------------------------------------------------------- * [`mouse2press`](https://docs.volt.bz/docs/input/mouse2press) - Press right mouse * [`mouse2release`](https://docs.volt.bz/docs/input/mouse2release) - Release right mouse * [`mouse1click`](https://docs.volt.bz/docs/input/mouse1click) - Left click [mouse1release\ \ Previous Page](https://docs.volt.bz/docs/input/mouse1release) [mouse2press\ \ Next Page](https://docs.volt.bz/docs/input/mouse2press) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse2click#syntax) [Returns](https://docs.volt.bz/docs/input/mouse2click#returns) [Description](https://docs.volt.bz/docs/input/mouse2click#description) [Example](https://docs.volt.bz/docs/input/mouse2click#example) [Related Functions](https://docs.volt.bz/docs/input/mouse2click#related-functions) --- # Volt Documentation [Scripts](https://docs.volt.bz/docs/scripts) getscripthash ============= Gets a hash of a script's bytecode. [Syntax](https://docs.volt.bz/docs/scripts/getscripthash#syntax) ----------------------------------------------------------------- getscripthash(script: LocalScript | ModuleScript) -> string [Parameters](https://docs.volt.bz/docs/scripts/getscripthash#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `script` | `LocalScript` or `ModuleScript` | The script | [Returns](https://docs.volt.bz/docs/scripts/getscripthash#returns) ------------------------------------------------------------------- | Type | Description | | --- | --- | | `string` | A hash string of the bytecode | [Description](https://docs.volt.bz/docs/scripts/getscripthash#description) --------------------------------------------------------------------------- `getscripthash` returns a hash of a script's compiled bytecode. Scripts with identical code will have the same hash. [Example](https://docs.volt.bz/docs/scripts/getscripthash#example) ------------------------------------------------------------------- local scripts = getrunningscripts() if #scripts > 0 then local hash = getscripthash(scripts[1]) print("Script hash:", hash) end [Comparing Scripts](https://docs.volt.bz/docs/scripts/getscripthash#comparing-scripts) --------------------------------------------------------------------------------------- local function sameCode(script1, script2) return getscripthash(script1) == getscripthash(script2) end [Tracking Changes](https://docs.volt.bz/docs/scripts/getscripthash#tracking-changes) ------------------------------------------------------------------------------------- local scriptHashes = {} local function hasScriptChanged(script) local currentHash = getscripthash(script) local previousHash = scriptHashes[script] scriptHashes[script] = currentHash return previousHash ~= nil and previousHash ~= currentHash end [Related Functions](https://docs.volt.bz/docs/scripts/getscripthash#related-functions) --------------------------------------------------------------------------------------- * [`getscriptbytecode`](https://docs.volt.bz/docs/scripts/getscriptbytecode) - Get the actual bytecode * [`getfunctionhash`](https://docs.volt.bz/docs/closures/getfunctionhash) - Hash a function [getscriptfromthread\ \ Previous Page](https://docs.volt.bz/docs/scripts/getscriptfromthread) [getscripts\ \ Next Page](https://docs.volt.bz/docs/scripts/getscripts) ### On this page [Syntax](https://docs.volt.bz/docs/scripts/getscripthash#syntax) [Parameters](https://docs.volt.bz/docs/scripts/getscripthash#parameters) [Returns](https://docs.volt.bz/docs/scripts/getscripthash#returns) [Description](https://docs.volt.bz/docs/scripts/getscripthash#description) [Example](https://docs.volt.bz/docs/scripts/getscripthash#example) [Comparing Scripts](https://docs.volt.bz/docs/scripts/getscripthash#comparing-scripts) [Tracking Changes](https://docs.volt.bz/docs/scripts/getscripthash#tracking-changes) [Related Functions](https://docs.volt.bz/docs/scripts/getscripthash#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) queueonteleport =============== Queues a script to run after teleporting. [Syntax](https://docs.volt.bz/docs/miscellaneous/queueonteleport#syntax) ------------------------------------------------------------------------- queueonteleport(script: string) -> void [Aliases](https://docs.volt.bz/docs/miscellaneous/queueonteleport#aliases) --------------------------------------------------------------------------- * `queue_on_teleport` * `queueteleport` [Parameters](https://docs.volt.bz/docs/miscellaneous/queueonteleport#parameters) --------------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `script` | `string` | The Lua code to run after teleport | [Returns](https://docs.volt.bz/docs/miscellaneous/queueonteleport#returns) --------------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/queueonteleport#description) ----------------------------------------------------------------------------------- `queueonteleport` queues Lua code to be executed after the player teleports to another place. The script will run once the new place loads. [Example](https://docs.volt.bz/docs/miscellaneous/queueonteleport#example) --------------------------------------------------------------------------- -- Queue a script to run after teleporting queueonteleport([[\ print("Teleported successfully!")\ -- Your script code here\ ]]) -- Teleport the player game:GetService("TeleportService"):Teleport(placeId) [Auto-Execute Example](https://docs.volt.bz/docs/miscellaneous/queueonteleport#auto-execute-example) ----------------------------------------------------------------------------------------------------- -- Queue the current script to run again queueonteleport(game:HttpGet("https://example.com/script.lua")) [Notes](https://docs.volt.bz/docs/miscellaneous/queueonteleport#notes) ----------------------------------------------------------------------- * Only one script can be queued at a time * Use `clearqueueonteleport` to clear the queue * The script runs in a fresh environment [Related Functions](https://docs.volt.bz/docs/miscellaneous/queueonteleport#related-functions) ----------------------------------------------------------------------------------------------- * [`clearqueueonteleport`](https://docs.volt.bz/docs/miscellaneous/clearqueueonteleport) - Clear the queue [messagebox\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/messagebox) [request\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/request) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/queueonteleport#syntax) [Aliases](https://docs.volt.bz/docs/miscellaneous/queueonteleport#aliases) [Parameters](https://docs.volt.bz/docs/miscellaneous/queueonteleport#parameters) [Returns](https://docs.volt.bz/docs/miscellaneous/queueonteleport#returns) [Description](https://docs.volt.bz/docs/miscellaneous/queueonteleport#description) [Example](https://docs.volt.bz/docs/miscellaneous/queueonteleport#example) [Auto-Execute Example](https://docs.volt.bz/docs/miscellaneous/queueonteleport#auto-execute-example) [Notes](https://docs.volt.bz/docs/miscellaneous/queueonteleport#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/queueonteleport#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.getupvalues ================= Gets all upvalues from a function. [Syntax](https://docs.volt.bz/docs/debug/getupvalues#syntax) ------------------------------------------------------------- debug.getupvalues(func: function | number) -> table [Parameters](https://docs.volt.bz/docs/debug/getupvalues#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | [Returns](https://docs.volt.bz/docs/debug/getupvalues#returns) --------------------------------------------------------------- | Type | Description | | --- | --- | | `table` | A table mapping indices to upvalue values | [Description](https://docs.volt.bz/docs/debug/getupvalues#description) ----------------------------------------------------------------------- `debug.getupvalues` returns a table containing all upvalues (captured variables) of a function. [Example](https://docs.volt.bz/docs/debug/getupvalues#example) --------------------------------------------------------------- local a = 1 local b = "hello" local c = {key = "value"} local function example() print(a, b, c.key) end local upvalues = debug.getupvalues(example) for i, v in pairs(upvalues) do print(i, type(v), v) end --[[\ Output:\ 1 number 1\ 2 string hello\ 3 table table: 0x...\ ]] [Practical Use](https://docs.volt.bz/docs/debug/getupvalues#practical-use) --------------------------------------------------------------------------- -- Find all string upvalues in a function local function getStringUpvalues(func) local strings = {} for i, upvalue in pairs(debug.getupvalues(func)) do if type(upvalue) == "string" then strings[i] = upvalue end end return strings end [Related Functions](https://docs.volt.bz/docs/debug/getupvalues#related-functions) ----------------------------------------------------------------------------------- * [`debug.getupvalue`](https://docs.volt.bz/docs/debug/getupvalue) - Get a single upvalue * [`debug.setupvalue`](https://docs.volt.bz/docs/debug/setupvalue) - Modify an upvalue [debug.getupvalue\ \ Previous Page](https://docs.volt.bz/docs/debug/getupvalue) [debug.setconstant\ \ Next Page](https://docs.volt.bz/docs/debug/setconstant) ### On this page [Syntax](https://docs.volt.bz/docs/debug/getupvalues#syntax) [Parameters](https://docs.volt.bz/docs/debug/getupvalues#parameters) [Returns](https://docs.volt.bz/docs/debug/getupvalues#returns) [Description](https://docs.volt.bz/docs/debug/getupvalues#description) [Example](https://docs.volt.bz/docs/debug/getupvalues#example) [Practical Use](https://docs.volt.bz/docs/debug/getupvalues#practical-use) [Related Functions](https://docs.volt.bz/docs/debug/getupvalues#related-functions) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse2press =========== Simulates pressing the right mouse button. [Syntax](https://docs.volt.bz/docs/input/mouse2press#syntax) ------------------------------------------------------------- mouse2press() -> void [Returns](https://docs.volt.bz/docs/input/mouse2press#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse2press#description) ----------------------------------------------------------------------- `mouse2press` simulates pressing down the right mouse button. Use `mouse2release` to release it. [Example](https://docs.volt.bz/docs/input/mouse2press#example) --------------------------------------------------------------- mouse2press() task.wait(0.5) mouse2release() [Related Functions](https://docs.volt.bz/docs/input/mouse2press#related-functions) ----------------------------------------------------------------------------------- * [`mouse2release`](https://docs.volt.bz/docs/input/mouse2release) - Release right mouse * [`mouse2click`](https://docs.volt.bz/docs/input/mouse2click) - Click right mouse [mouse2click\ \ Previous Page](https://docs.volt.bz/docs/input/mouse2click) [mouse2release\ \ Next Page](https://docs.volt.bz/docs/input/mouse2release) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse2press#syntax) [Returns](https://docs.volt.bz/docs/input/mouse2press#returns) [Description](https://docs.volt.bz/docs/input/mouse2press#description) [Example](https://docs.volt.bz/docs/input/mouse2press#example) [Related Functions](https://docs.volt.bz/docs/input/mouse2press#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) request ======= Makes an HTTP request. [Syntax](https://docs.volt.bz/docs/miscellaneous/request#syntax) ----------------------------------------------------------------- request(options: table) -> table [Parameters](https://docs.volt.bz/docs/miscellaneous/request#parameters) ------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `options` | `table` | Request configuration | ### [Options Table](https://docs.volt.bz/docs/miscellaneous/request#options-table) | Field | Type | Description | | --- | --- | --- | | `Url` | `string` | The URL to request | | `Method` | `string?` | HTTP method (GET, POST, etc.) | | `Headers` | `table?` | Request headers | | `Body` | `string?` | Request body | [Returns](https://docs.volt.bz/docs/miscellaneous/request#returns) ------------------------------------------------------------------- ### [Response Table](https://docs.volt.bz/docs/miscellaneous/request#response-table) | Field | Type | Description | | --- | --- | --- | | `Success` | `boolean` | Whether the request succeeded | | `StatusCode` | `number` | HTTP status code | | `StatusMessage` | `string` | HTTP status message | | `Headers` | `table` | Response headers | | `Body` | `string` | Response body | [Example: GET Request](https://docs.volt.bz/docs/miscellaneous/request#example-get-request) -------------------------------------------------------------------------------------------- local response = request({ Url = "https://httpbin.org/get", Method = "GET" }) if response.Success then print("Status:", response.StatusCode) print("Body:", response.Body) end [Example: POST Request](https://docs.volt.bz/docs/miscellaneous/request#example-post-request) ---------------------------------------------------------------------------------------------- local HttpService = game:GetService("HttpService") local response = request({ Url = "https://httpbin.org/post", Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = HttpService:JSONEncode({ username = "player", score = 100 }) }) if response.Success then local data = HttpService:JSONDecode(response.Body) print(data) end [Error Handling](https://docs.volt.bz/docs/miscellaneous/request#error-handling) --------------------------------------------------------------------------------- local success, response = pcall(request, { Url = "https://example.com/api", Method = "GET" }) if success and response.Success then print("Got data:", response.Body) elseif success then warn("HTTP Error:", response.StatusCode, response.StatusMessage) else warn("Request failed:", response) end [Aliases](https://docs.volt.bz/docs/miscellaneous/request#aliases) ------------------------------------------------------------------- * `http_request` * `http.request` [queueonteleport\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/queueonteleport) [saveinstance\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/saveinstance) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/request#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/request#parameters) [Options Table](https://docs.volt.bz/docs/miscellaneous/request#options-table) [Returns](https://docs.volt.bz/docs/miscellaneous/request#returns) [Response Table](https://docs.volt.bz/docs/miscellaneous/request#response-table) [Example: GET Request](https://docs.volt.bz/docs/miscellaneous/request#example-get-request) [Example: POST Request](https://docs.volt.bz/docs/miscellaneous/request#example-post-request) [Error Handling](https://docs.volt.bz/docs/miscellaneous/request#error-handling) [Aliases](https://docs.volt.bz/docs/miscellaneous/request#aliases) --- # Volt Documentation [Input](https://docs.volt.bz/docs/input) mouse2release ============= Simulates releasing the right mouse button. [Syntax](https://docs.volt.bz/docs/input/mouse2release#syntax) --------------------------------------------------------------- mouse2release() -> void [Returns](https://docs.volt.bz/docs/input/mouse2release#returns) ----------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/input/mouse2release#description) ------------------------------------------------------------------------- `mouse2release` simulates releasing the right mouse button that was pressed with `mouse2press`. [Example](https://docs.volt.bz/docs/input/mouse2release#example) ----------------------------------------------------------------- mouse2press() task.wait(0.5) mouse2release() [Related Functions](https://docs.volt.bz/docs/input/mouse2release#related-functions) ------------------------------------------------------------------------------------- * [`mouse2press`](https://docs.volt.bz/docs/input/mouse2press) - Press right mouse * [`mouse2click`](https://docs.volt.bz/docs/input/mouse2click) - Click right mouse [mouse2press\ \ Previous Page](https://docs.volt.bz/docs/input/mouse2press) [mousemoveabs\ \ Next Page](https://docs.volt.bz/docs/input/mousemoveabs) ### On this page [Syntax](https://docs.volt.bz/docs/input/mouse2release#syntax) [Returns](https://docs.volt.bz/docs/input/mouse2release#returns) [Description](https://docs.volt.bz/docs/input/mouse2release#description) [Example](https://docs.volt.bz/docs/input/mouse2release#example) [Related Functions](https://docs.volt.bz/docs/input/mouse2release#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.setstack ============== Sets a value on the stack at a specific level and index. [Syntax](https://docs.volt.bz/docs/debug/setstack#syntax) ---------------------------------------------------------- debug.setstack(level: number, index: number, value: any) -> void [Parameters](https://docs.volt.bz/docs/debug/setstack#parameters) ------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `level` | `number` | The stack level (1 = current function) | | `index` | `number` | The stack slot index | | `value` | `any` | The new value to set | [Returns](https://docs.volt.bz/docs/debug/setstack#returns) ------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/debug/setstack#description) -------------------------------------------------------------------- `debug.setstack` modifies a value on the call stack. This can change local variables in any active function on the stack. [Example](https://docs.volt.bz/docs/debug/setstack#example) ------------------------------------------------------------ local function modifier() debug.setstack(2, 1, "modified!") end local function example() local value = "original" modifier() print(value) -- "modified!" end example() [Caution](https://docs.volt.bz/docs/debug/setstack#caution) ------------------------------------------------------------ Modifying stack values can cause crashes or undefined behavior if: * You set an incompatible type * The index doesn't exist * The value is used in unexpected ways [Related Functions](https://docs.volt.bz/docs/debug/setstack#related-functions) -------------------------------------------------------------------------------- * [`debug.getstack`](https://docs.volt.bz/docs/debug/getstack) - Get a stack value [debug.setconstant\ \ Previous Page](https://docs.volt.bz/docs/debug/setconstant) [debug.setupvalue\ \ Next Page](https://docs.volt.bz/docs/debug/setupvalue) ### On this page [Syntax](https://docs.volt.bz/docs/debug/setstack#syntax) [Parameters](https://docs.volt.bz/docs/debug/setstack#parameters) [Returns](https://docs.volt.bz/docs/debug/setstack#returns) [Description](https://docs.volt.bz/docs/debug/setstack#description) [Example](https://docs.volt.bz/docs/debug/setstack#example) [Caution](https://docs.volt.bz/docs/debug/setstack#caution) [Related Functions](https://docs.volt.bz/docs/debug/setstack#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) newcclosure =========== Wraps a Luau function to appear as a C closure. [Syntax](https://docs.volt.bz/docs/closures/newcclosure#syntax) ---------------------------------------------------------------- newcclosure(func: function, debugname: string?) -> function [Parameters](https://docs.volt.bz/docs/closures/newcclosure#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The Luau function to wrap | | `debugname` | `string?` | Optional name for debugging/stack traces | [Returns](https://docs.volt.bz/docs/closures/newcclosure#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `function` | A C closure wrapper that calls the original function | [Description](https://docs.volt.bz/docs/closures/newcclosure#description) -------------------------------------------------------------------------- `newcclosure` wraps a Luau function so that it appears to be a C closure when inspected. The wrapped function behaves identically but `iscclosure` will return `true` for it. [Example](https://docs.volt.bz/docs/closures/newcclosure#example) ------------------------------------------------------------------ local function myHook(...) print("Hooked!") return ... end -- Check before wrapping print(iscclosure(myHook)) -- false -- Wrap it local wrapped = newcclosure(myHook) -- Now it appears as a C closure print(iscclosure(wrapped)) -- true -- But still works the same wrapped("test") -- Output: Hooked! [With Debug Name](https://docs.volt.bz/docs/closures/newcclosure#with-debug-name) ---------------------------------------------------------------------------------- local function handler() print("Handling request") end -- Wrap with a custom debug name local wrapped = newcclosure(handler, "RequestHandler") -- The debug name appears in stack traces and debug.info [Notes](https://docs.volt.bz/docs/closures/newcclosure#notes) -------------------------------------------------------------- * The wrapper has minimal performance overhead * Errors are modified for hooking purposes * The optional `debugname` parameter sets the function name for debugging [Related Functions](https://docs.volt.bz/docs/closures/newcclosure#related-functions) -------------------------------------------------------------------------------------- * [`newlclosure`](https://docs.volt.bz/docs/closures/newlclosure) - Wrap as Luau closure * [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) - Check if C closure * [`isnewcclosure`](https://docs.volt.bz/docs/closures/isnewcclosure) - Check if newcclosure [isnewcclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/isnewcclosure) [newlclosure\ \ Next Page](https://docs.volt.bz/docs/closures/newlclosure) ### On this page [Syntax](https://docs.volt.bz/docs/closures/newcclosure#syntax) [Parameters](https://docs.volt.bz/docs/closures/newcclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/newcclosure#returns) [Description](https://docs.volt.bz/docs/closures/newcclosure#description) [Example](https://docs.volt.bz/docs/closures/newcclosure#example) [With Debug Name](https://docs.volt.bz/docs/closures/newcclosure#with-debug-name) [Notes](https://docs.volt.bz/docs/closures/newcclosure#notes) [Related Functions](https://docs.volt.bz/docs/closures/newcclosure#related-functions) --- # Volt Documentation [Filesystem](https://docs.volt.bz/docs/filesystem) loadfile ======== Loads a Lua file and returns it as a function. [Syntax](https://docs.volt.bz/docs/filesystem/loadfile#syntax) --------------------------------------------------------------- loadfile(path: string) -> function?, string? [Parameters](https://docs.volt.bz/docs/filesystem/loadfile#parameters) ----------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `path` | `string` | The file path | [Returns](https://docs.volt.bz/docs/filesystem/loadfile#returns) ----------------------------------------------------------------- | Type | Description | | --- | --- | | `function?` | The loaded function, or nil on error | | `string?` | Error message if loading failed | [Description](https://docs.volt.bz/docs/filesystem/loadfile#description) ------------------------------------------------------------------------- `loadfile` reads a Lua file, compiles it, and returns it as a callable function. This is similar to `loadstring` but reads from a file. [Example](https://docs.volt.bz/docs/filesystem/loadfile#example) ----------------------------------------------------------------- -- Create a Lua file writefile("mymodule.lua", [[\ local message = "Hello from file!"\ return message\ ]]) -- Load and execute it local func, err = loadfile("mymodule.lua") if func then local result = func() print(result) -- "Hello from file!" else warn("Error:", err) end [Module System](https://docs.volt.bz/docs/filesystem/loadfile#module-system) ----------------------------------------------------------------------------- -- Create a module file writefile("utils.lua", [[\ local Utils = {}\ \ function Utils.greet(name)\ return "Hello, " .. name .. "!"\ end\ \ function Utils.add(a, b)\ return a + b\ end\ \ return Utils\ ]]) -- Load and use the module local Utils = loadfile("utils.lua")() print(Utils.greet("World")) -- "Hello, World!" print(Utils.add(2, 3)) -- 5 [Error Handling](https://docs.volt.bz/docs/filesystem/loadfile#error-handling) ------------------------------------------------------------------------------- local function safeLoadFile(path) if not isfile(path) then return nil, "File not found" end return loadfile(path) end [Related Functions](https://docs.volt.bz/docs/filesystem/loadfile#related-functions) ------------------------------------------------------------------------------------- * [`readfile`](https://docs.volt.bz/docs/filesystem/readfile) - Read raw file contents * [`loadstring`](https://docs.volt.bz/docs/scripts/loadstring) - Load Lua from a string [listfiles\ \ Previous Page](https://docs.volt.bz/docs/filesystem/listfiles) [makefolder\ \ Next Page](https://docs.volt.bz/docs/filesystem/makefolder) ### On this page [Syntax](https://docs.volt.bz/docs/filesystem/loadfile#syntax) [Parameters](https://docs.volt.bz/docs/filesystem/loadfile#parameters) [Returns](https://docs.volt.bz/docs/filesystem/loadfile#returns) [Description](https://docs.volt.bz/docs/filesystem/loadfile#description) [Example](https://docs.volt.bz/docs/filesystem/loadfile#example) [Module System](https://docs.volt.bz/docs/filesystem/loadfile#module-system) [Error Handling](https://docs.volt.bz/docs/filesystem/loadfile#error-handling) [Related Functions](https://docs.volt.bz/docs/filesystem/loadfile#related-functions) --- # Volt Documentation [Debug](https://docs.volt.bz/docs/debug) debug.setconstant ================= Sets a constant in a function at the specified index. [Syntax](https://docs.volt.bz/docs/debug/setconstant#syntax) ------------------------------------------------------------- debug.setconstant(func: function | number, index: number, value: any) -> void [Parameters](https://docs.volt.bz/docs/debug/setconstant#parameters) --------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` or `number` | The function or stack level | | `index` | `number` | The constant index (1-based) | | `value` | `any` | The new value for the constant | [Returns](https://docs.volt.bz/docs/debug/setconstant#returns) --------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/debug/setconstant#description) ----------------------------------------------------------------------- `debug.setconstant` modifies a constant value in a function's bytecode. This allows you to change literal values that the function uses. [Example](https://docs.volt.bz/docs/debug/setconstant#example) --------------------------------------------------------------- local function greet() return "Hello, World!" end print(greet()) -- "Hello, World!" -- Find and change the string constant local constants = debug.getconstants(greet) for i, v in pairs(constants) do if v == "Hello, World!" then debug.setconstant(greet, i, "Goodbye, World!") break end end print(greet()) -- "Goodbye, World!" [Caution](https://docs.volt.bz/docs/debug/setconstant#caution) --------------------------------------------------------------- Modifying constants can cause unexpected behavior if: * The constant is used in multiple places * You set an incompatible type * The bytecode expects a specific value [Use Cases](https://docs.volt.bz/docs/debug/setconstant#use-cases) ------------------------------------------------------------------- * **Patching**: Change hardcoded values in game scripts * **Testing**: Modify behavior without changing source * **Bypasses**: Alter check values [Related Functions](https://docs.volt.bz/docs/debug/setconstant#related-functions) ----------------------------------------------------------------------------------- * [`debug.getconstant`](https://docs.volt.bz/docs/debug/getconstant) - Get a constant * [`debug.getconstants`](https://docs.volt.bz/docs/debug/getconstants) - Get all constants [debug.getupvalues\ \ Previous Page](https://docs.volt.bz/docs/debug/getupvalues) [debug.setstack\ \ Next Page](https://docs.volt.bz/docs/debug/setstack) ### On this page [Syntax](https://docs.volt.bz/docs/debug/setconstant#syntax) [Parameters](https://docs.volt.bz/docs/debug/setconstant#parameters) [Returns](https://docs.volt.bz/docs/debug/setconstant#returns) [Description](https://docs.volt.bz/docs/debug/setconstant#description) [Example](https://docs.volt.bz/docs/debug/setconstant#example) [Caution](https://docs.volt.bz/docs/debug/setconstant#caution) [Use Cases](https://docs.volt.bz/docs/debug/setconstant#use-cases) [Related Functions](https://docs.volt.bz/docs/debug/setconstant#related-functions) --- # Volt Documentation [Instances](https://docs.volt.bz/docs/instances) getinstancecache ================ Gets all cached instance references. [Syntax](https://docs.volt.bz/docs/instances/getinstancecache#syntax) ---------------------------------------------------------------------- getinstancecache() -> table [Returns](https://docs.volt.bz/docs/instances/getinstancecache#returns) ------------------------------------------------------------------------ | Type | Description | | --- | --- | | `table` | Dictionary of cached instances | [Description](https://docs.volt.bz/docs/instances/getinstancecache#description) -------------------------------------------------------------------------------- `getinstancecache` returns a table containing all currently cached instance references. [Example](https://docs.volt.bz/docs/instances/getinstancecache#example) ------------------------------------------------------------------------ local cache = getinstancecache() print("Cached instances:", #cache) for address, instance in pairs(cache) do print(address, instance:GetFullName()) end [Related Functions](https://docs.volt.bz/docs/instances/getinstancecache#related-functions) -------------------------------------------------------------------------------------------- * [`cache.invalidate`](https://docs.volt.bz/docs/cache/invalidate) - Remove from cache * [`cache.replace`](https://docs.volt.bz/docs/cache/replace) - Replace cached instance * [`cache.iscached`](https://docs.volt.bz/docs/cache/iscached) - Check if cached [gethui\ \ Previous Page](https://docs.volt.bz/docs/instances/gethui) [getinstances\ \ Next Page](https://docs.volt.bz/docs/instances/getinstances) ### On this page [Syntax](https://docs.volt.bz/docs/instances/getinstancecache#syntax) [Returns](https://docs.volt.bz/docs/instances/getinstancecache#returns) [Description](https://docs.volt.bz/docs/instances/getinstancecache#description) [Example](https://docs.volt.bz/docs/instances/getinstancecache#example) [Related Functions](https://docs.volt.bz/docs/instances/getinstancecache#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) newlclosure =========== Wraps a C closure to appear as a Luau closure. [Syntax](https://docs.volt.bz/docs/closures/newlclosure#syntax) ---------------------------------------------------------------- newlclosure(func: function) -> function [Parameters](https://docs.volt.bz/docs/closures/newlclosure#parameters) ------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The C closure to wrap | [Returns](https://docs.volt.bz/docs/closures/newlclosure#returns) ------------------------------------------------------------------ | Type | Description | | --- | --- | | `function` | A Luau closure wrapper that calls the original function | [Description](https://docs.volt.bz/docs/closures/newlclosure#description) -------------------------------------------------------------------------- `newlclosure` wraps a C closure so that it appears to be a Luau closure when inspected. The wrapped function behaves identically but `islclosure` will return `true` for it. [Example](https://docs.volt.bz/docs/closures/newlclosure#example) ------------------------------------------------------------------ -- print is a C closure print(iscclosure(print)) -- true print(islclosure(print)) -- false -- Wrap it as a Luau closure local wrappedPrint = newlclosure(print) -- Now it appears as a Luau closure print(iscclosure(wrappedPrint)) -- false print(islclosure(wrappedPrint)) -- true -- But still works the same wrappedPrint("Hello!") -- Output: Hello! [Notes](https://docs.volt.bz/docs/closures/newlclosure#notes) -------------------------------------------------------------- * The wrapper has minimal performance overhead [Related Functions](https://docs.volt.bz/docs/closures/newlclosure#related-functions) -------------------------------------------------------------------------------------- * [`newcclosure`](https://docs.volt.bz/docs/closures/newcclosure) - Wrap as C closure * [`islclosure`](https://docs.volt.bz/docs/closures/islclosure) - Check if Luau closure * [`iscclosure`](https://docs.volt.bz/docs/closures/iscclosure) - Check if C closure [newcclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/newcclosure) [restorefunction\ \ Next Page](https://docs.volt.bz/docs/closures/restorefunction) ### On this page [Syntax](https://docs.volt.bz/docs/closures/newlclosure#syntax) [Parameters](https://docs.volt.bz/docs/closures/newlclosure#parameters) [Returns](https://docs.volt.bz/docs/closures/newlclosure#returns) [Description](https://docs.volt.bz/docs/closures/newlclosure#description) [Example](https://docs.volt.bz/docs/closures/newlclosure#example) [Notes](https://docs.volt.bz/docs/closures/newlclosure#notes) [Related Functions](https://docs.volt.bz/docs/closures/newlclosure#related-functions) --- # Volt Documentation [Miscellaneous](https://docs.volt.bz/docs/miscellaneous) saveinstance ============ Saves an instance (or the game) to a file. [Syntax](https://docs.volt.bz/docs/miscellaneous/saveinstance#syntax) ---------------------------------------------------------------------- saveinstance(options: table?) -> void [Parameters](https://docs.volt.bz/docs/miscellaneous/saveinstance#parameters) ------------------------------------------------------------------------------ | Parameter | Type | Description | | --- | --- | --- | | `options` | `table` | (Optional) Save options | [Options](https://docs.volt.bz/docs/miscellaneous/saveinstance#options) ------------------------------------------------------------------------ | Option | Type | Description | | --- | --- | --- | | `FilePath` | `string` | Output file path | | `Object` | `Instance` | Instance to save (default: game) | | `ExtraInstances` | `table` | Additional instances to include | | `NilInstances` | `boolean` | Include nil-parented instances | | `RemovePlayerCharacters` | `boolean` | Exclude player characters | | `Mode` | `string` | "optimized", "full", or "scripts" | [Returns](https://docs.volt.bz/docs/miscellaneous/saveinstance#returns) ------------------------------------------------------------------------ This function does not return a value. [Description](https://docs.volt.bz/docs/miscellaneous/saveinstance#description) -------------------------------------------------------------------------------- `saveinstance` exports an instance hierarchy to an RBXL/RBXM file, which can be opened in Roblox Studio. [Example](https://docs.volt.bz/docs/miscellaneous/saveinstance#example) ------------------------------------------------------------------------ -- Save the entire game saveinstance({ FilePath = "game.rbxl" }) -- Save a specific model saveinstance({ FilePath = "model.rbxm", Object = workspace.MyModel }) -- Save with options saveinstance({ FilePath = "full_game.rbxl", NilInstances = true, Mode = "full" }) [Notes](https://docs.volt.bz/docs/miscellaneous/saveinstance#notes) -------------------------------------------------------------------- * File is saved to the workspace folder * Large games may take time to save * Some instances may not save properly [Related Functions](https://docs.volt.bz/docs/miscellaneous/saveinstance#related-functions) -------------------------------------------------------------------------------------------- * [`saveplace`](https://docs.volt.bz/docs/miscellaneous/saveplace) - Shorthand for saving game [request\ \ Previous Page](https://docs.volt.bz/docs/miscellaneous/request) [saveplace\ \ Next Page](https://docs.volt.bz/docs/miscellaneous/saveplace) ### On this page [Syntax](https://docs.volt.bz/docs/miscellaneous/saveinstance#syntax) [Parameters](https://docs.volt.bz/docs/miscellaneous/saveinstance#parameters) [Options](https://docs.volt.bz/docs/miscellaneous/saveinstance#options) [Returns](https://docs.volt.bz/docs/miscellaneous/saveinstance#returns) [Description](https://docs.volt.bz/docs/miscellaneous/saveinstance#description) [Example](https://docs.volt.bz/docs/miscellaneous/saveinstance#example) [Notes](https://docs.volt.bz/docs/miscellaneous/saveinstance#notes) [Related Functions](https://docs.volt.bz/docs/miscellaneous/saveinstance#related-functions) --- # Volt Documentation [Closures](https://docs.volt.bz/docs/closures) restorefunction =============== Restores a hooked function to its original implementation. [Syntax](https://docs.volt.bz/docs/closures/restorefunction#syntax) -------------------------------------------------------------------- restorefunction(func: function) -> void [Parameters](https://docs.volt.bz/docs/closures/restorefunction#parameters) ---------------------------------------------------------------------------- | Parameter | Type | Description | | --- | --- | --- | | `func` | `function` | The hooked function to restore | [Returns](https://docs.volt.bz/docs/closures/restorefunction#returns) ---------------------------------------------------------------------- This function does not return a value. [Description](https://docs.volt.bz/docs/closures/restorefunction#description) ------------------------------------------------------------------------------ `restorefunction` removes a hook from a function, restoring it to its original behavior. This is useful for cleanup or when you need to temporarily remove a hook. [Example](https://docs.volt.bz/docs/closures/restorefunction#example) ---------------------------------------------------------------------- -- Hook print local originalPrint = hookfunction(print, function(...) originalPrint("[HOOKED]", ...) end) print("Test 1") -- Output: [HOOKED] Test 1 -- Restore the original restorefunction(print) print("Test 2") -- Output: Test 2 (no prefix) [Notes](https://docs.volt.bz/docs/closures/restorefunction#notes) ------------------------------------------------------------------ * Only works on functions that were hooked by volt * Has no effect on functions that aren't currently hooked * The original function reference from `hookfunction` remains valid [Aliases](https://docs.volt.bz/docs/closures/restorefunction#aliases) ---------------------------------------------------------------------- * `restorefunc` [newlclosure\ \ Previous Page](https://docs.volt.bz/docs/closures/newlclosure) [setstackhidden\ \ Next Page](https://docs.volt.bz/docs/closures/setstackhidden) ### On this page [Syntax](https://docs.volt.bz/docs/closures/restorefunction#syntax) [Parameters](https://docs.volt.bz/docs/closures/restorefunction#parameters) [Returns](https://docs.volt.bz/docs/closures/restorefunction#returns) [Description](https://docs.volt.bz/docs/closures/restorefunction#description) [Example](https://docs.volt.bz/docs/closures/restorefunction#example) [Notes](https://docs.volt.bz/docs/closures/restorefunction#notes) [Aliases](https://docs.volt.bz/docs/closures/restorefunction#aliases) ---