# Table of Contents - [Cache | Potassium API](#cache-potassium-api) - [Cache | Potassium API](#cache-potassium-api) - [Closures | Potassium API](#closures-potassium-api) - [Crypt | Potassium API](#crypt-potassium-api) - [Debug | Potassium API](#debug-potassium-api) - [Console | Potassium API](#console-potassium-api) - [Metatable | Potassium API](#metatable-potassium-api) - [Input | Potassium API](#input-potassium-api) - [File System | Potassium API](#file-system-potassium-api) - [Drawing | Potassium API](#drawing-potassium-api) - [Scripts | Potassium API](#scripts-potassium-api) - [Instance | Potassium API](#instance-potassium-api) - [Miscellaneous | Potassium API](#miscellaneous-potassium-api) - [Actor | Potassium API](#actor-potassium-api) - [Web Sockets | Potassium API](#web-sockets-potassium-api) - [Cache | Potassium API](#cache-potassium-api) --- # Cache | Potassium API [hashtag](https://potassium.gitbook.io/#cache.invalidate) cache.invalidate ------------------------------------------------------------------------------- Copy cache.invalidate( object) Deletes `object` from the Instance cache. Effectively invalidates `object` as a reference to the underlying Instance. * * * [hashtag](https://potassium.gitbook.io/#cache.iscached) cache.iscached --------------------------------------------------------------------------- Copy cache.iscached( object) Checks whether `object` exists in the Instance cache. * * * [hashtag](https://potassium.gitbook.io/#cache.replace) cache.replace ------------------------------------------------------------------------- Copy cache.replace( object, newobject) Replaces `object` in the Instance cache with `newObject`. * * * [hashtag](https://potassium.gitbook.io/#cloneref) cloneref --------------------------------------------------------------- Copy cloneref( object) Returns a copy of the Instance reference to `object`. This is useful for managing an Instance without directly referencing it. * * * [hashtag](https://potassium.gitbook.io/#compareinstances) compareinstances ------------------------------------------------------------------------------- Copy compareinstances( a, b) Returns whether objects `a` and `b` both reference the same Instance. * * * [NextClosureschevron-right](https://potassium.gitbook.io/api/environment/closures) Last updated 1 year ago --- # Cache | Potassium API [hashtag](https://potassium.gitbook.io/api#cache.invalidate) cache.invalidate ---------------------------------------------------------------------------------- Copy cache.invalidate( object) Deletes `object` from the Instance cache. Effectively invalidates `object` as a reference to the underlying Instance. * * * [hashtag](https://potassium.gitbook.io/api#cache.iscached) cache.iscached ------------------------------------------------------------------------------ Copy cache.iscached( object) Checks whether `object` exists in the Instance cache. * * * [hashtag](https://potassium.gitbook.io/api#cache.replace) cache.replace ---------------------------------------------------------------------------- Copy cache.replace( object, newobject) Replaces `object` in the Instance cache with `newObject`. * * * [hashtag](https://potassium.gitbook.io/api#cloneref) cloneref ------------------------------------------------------------------ Copy cloneref( object) Returns a copy of the Instance reference to `object`. This is useful for managing an Instance without directly referencing it. * * * [hashtag](https://potassium.gitbook.io/api#compareinstances) compareinstances ---------------------------------------------------------------------------------- Copy compareinstances( a, b) Returns whether objects `a` and `b` both reference the same Instance. * * * [NextClosureschevron-right](https://potassium.gitbook.io/api/environment/closures) Last updated 1 year ago --- # Closures | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/closures#checkcaller) checkcaller --------------------------------------------------------------------------------------------- Copy checkcaller() Returns whether the function currently running was called by the executor. This is useful for metamethod hooks that behave differently when called by the game. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#clonefunction) clonefunction ------------------------------------------------------------------------------------------------- Copy clonefunction( func) Generates a new closure based on the bytecode of function `func`. Copy local function foo() print("Hello, world!") end local bar = clonefunction(foo) foo() --> Hello, world! bar() --> Hello, world! print(foo == bar) --> false * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#getcallingscript) getcallingscript ------------------------------------------------------------------------------------------------------- Copy getcallingscript() Returns the script responsible for the currently running function. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#hookfunction) hookfunction ----------------------------------------------------------------------------------------------- Copy hookfunction( func, hook) Replaces `func` with `hook` internally, where `hook` will be invoked in place of `func` when called. Returns a new function that can be used to access the original definition of `func`. If `func` is a Luau function (`islclosure(func) --> true`), the upvalue count of `hook` must be less than or equal to that of `func`. [Lua visibility rulesarrow-up-right](http://www.lua.org/manual/5.1/manual.html#2.6) Copy local function foo() print("Hello, world!") end local fooRef = hookfunction(foo, function(...) print("Hooked!") end) foo() --> Hooked! fooRef() --> Hello, world! * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#iscclosure) iscclosure ------------------------------------------------------------------------------------------- Copy iscclosure( func) Returns whether or not `func` is a closure whose source is written in C. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#islclosure) islclosure ------------------------------------------------------------------------------------------- Copy islclosure( func) Returns whether or not `func` is a closure whose source is written in Luau. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#isexecutorclosure) isexecutorclosure --------------------------------------------------------------------------------------------------------- Copy isexecutorclosure( func) Returns whether or not `func` was created by the executor. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#loadstring) loadstring ------------------------------------------------------------------------------------------- Copy loadstring( source, chunkname) Generates a chunk from the given source code. The environment of the returned function is the global environment. If there are no compilation errors, the chunk is returned by itself; otherwise, it returns `nil` plus the error message. `chunkname` is used as the chunk name for error messages and debug information. * * * [hashtag](https://potassium.gitbook.io/api/environment/closures#newcclosure) newcclosure --------------------------------------------------------------------------------------------- Copy newcclosure( func) Returns a C closure that wraps `func`. The result is functionally identical to `func`, but identifies as a C closure. Copy local foo = function() return true end local bar = newcclosure(foo) print(bar()) --> true * * * [PreviousCachechevron-left](https://potassium.gitbook.io/api) [NextConsolechevron-right](https://potassium.gitbook.io/api/environment/console) Last updated 1 year ago --- # Crypt | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.base64encode) crypt.base64encode -------------------------------------------------------------------------------------------------------- Copy crypt.base64encode( data) Encodes a string of bytes into Base64. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.base64decode) crypt.base64decode -------------------------------------------------------------------------------------------------------- Copy crypt.base64decode( data) Decodes a Base64 string to a string of bytes. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.encrypt) crypt.encrypt ---------------------------------------------------------------------------------------------- Copy crypt.encrypt( data, key, iv, mode) Encrypts an unencoded string using AES encryption. Returns the base64 encoded and encrypted string, and the IV. If an AES IV is not provided, a random one will be generated for you, and returned as a 2nd base64 encoded string. The cipher modes are 'CBC', 'ECB', 'CTR', 'CFB', 'OFB', and 'GCM'. The default is 'CBC'. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.decrypt) crypt.decrypt ---------------------------------------------------------------------------------------------- Copy crypt.encrypt( data, key, iv, mode) Decrypts the base64 encoded and encrypted content. Returns the raw string. The cipher modes are 'CBC', 'ECB', 'CTR', 'CFB', 'OFB', and 'GCM'. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.generatebytes) crypt.generatebytes ---------------------------------------------------------------------------------------------------------- Copy crypt.generatebytes( size) Generates a random sequence of bytes of the given size. Returns the sequence as a base64 encoded string. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.generatekey) crypt.generatekey ------------------------------------------------------------------------------------------------------ Copy crypt.generatekey() Generates a base64 encoded 256-bit key. The result can be used as the second parameter for the `crypt.encrypt` and `crypt.decrypt` functions. * * * [hashtag](https://potassium.gitbook.io/api/environment/crypt#crypt.hash) crypt.hash ---------------------------------------------------------------------------------------- Copy crypt.hash( data, algo) Returns the result of hashing the data using the given algorithm. Some algorithms include 'sha1', 'sha384', 'sha512', 'md5', 'sha256', 'sha3-224', 'sha3-256', and 'sha3-512'. * * * [PreviousConsolechevron-left](https://potassium.gitbook.io/api/environment/console) [NextDebugchevron-right](https://potassium.gitbook.io/api/environment/debug) Last updated 1 year ago --- # Debug | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.isvalidlevel) debug.isvalidlevel -------------------------------------------------------------------------------------------------------- Copy debug.isvalidlevel( level) Returns whether `level` is a valid level or not. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getregistry) debug.getregistry ------------------------------------------------------------------------------------------------------ Copy > debug.getregistry() Returns the lua registry. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getconstant) debug.getconstant ------------------------------------------------------------------------------------------------------ Copy debug.getconstant( func, index) Returns the constant at `index` in the constant table of the function or level `func`. Throws an error if the constant does not exist. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getconstants) debug.getconstants -------------------------------------------------------------------------------------------------------- Copy > debug.getconstants( func) Returns the constant table of the function or level `func`. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getinfo) debug.getinfo ---------------------------------------------------------------------------------------------- Copy debug.getinfo( func) Returns debugger information about a function or stack level. #### [hashtag](https://potassium.gitbook.io/api/environment/debug#debuginfo) DebugInfo Field Type Description `source` string The name of the chunk that created the function. `short_src` string A "printable" version of `source` to be used in error messages. `func` function The function itself. `what` string The string "Lua" if the function is a Luau function, or "C" if it is a C function. `currentline` number The current line where the given function is executing. `name` string The name of the function. `nups` number The number of upvalues in the function. `numparams` number The number of parameters in the function. `is_vararg` number Whether the function has a variadic argument. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getproto) debug.getproto ------------------------------------------------------------------------------------------------ Copy > debug.getproto( func, index, active) Returns the proto at `index` in the function or level `func` if `active` is false. If `active` is true, then every active function of the proto is returned. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getprotos) debug.getprotos -------------------------------------------------------------------------------------------------- Copy > debug.getprotos( func) Returns a list of protos of the function or level `func`. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getstack) debug.getstack ------------------------------------------------------------------------------------------------ Copy > debug.getstack( func, index) Returns the value at `index` in the stack frame `level`. Throws an error if no value could be found. If `index` is not specified, then the entire stack frame is returned. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getupvalue) debug.getupvalue ---------------------------------------------------------------------------------------------------- Copy debug.getupvalue( func, index) Returns the upvalue at `index` in the function or level `func`. Throws an error if the upvalue does not exist. An upvalue is a local variable used by an inner function, and is also called an _external local variable_. Read more on [Lua visibility rulesarrow-up-right](http://www.lua.org/manual/5.1/manual.html#2.6) . * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.getupvalues) debug.getupvalues ------------------------------------------------------------------------------------------------------ Copy > debug.getupvalues( func) Returns a list of upvalues of the function or level `func`. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.setconstant) debug.setconstant ------------------------------------------------------------------------------------------------------ Copy debug.setconstant( func, index, value) Sets the constant at `index` in the function or level `func` to `value`. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.setstack) debug.setstack ------------------------------------------------------------------------------------------------ Copy debug.setstack( func, index, value) Sets the register at `index` in the stack frame `level` to `value`. * * * [hashtag](https://potassium.gitbook.io/api/environment/debug#debug.setupvalue) debug.setupvalue ---------------------------------------------------------------------------------------------------- Copy debug.setupvalue( func, index, value) Sets the upvalue at `index` in the function or level `func` to `value`. * * * [PreviousCryptchevron-left](https://potassium.gitbook.io/api/environment/crypt) [NextDrawingchevron-right](https://potassium.gitbook.io/api/environment/drawing) Last updated 1 year ago --- # Console | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/console#rconsoleclear) rconsoleclear ------------------------------------------------------------------------------------------------ Copy rconsoleclear() Clears the output of the console window. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsolecreate) rconsolecreate -------------------------------------------------------------------------------------------------- Copy rconsolecreate() ~Opens the console window. Text previously output to the console will not be cleared.~ ⚠️ This function is disabled. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsoledestroy) rconsoledestroy ---------------------------------------------------------------------------------------------------- Copy rconsoledestroy() Clears the output of the console window. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsoleinput) rconsoleinput ------------------------------------------------------------------------------------------------ Copy rconsoleinput() ~Waits for the user to input text into the console window. Returns the result.~ ⚠️ This function is disabled. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsoleprint) rconsoleprint ------------------------------------------------------------------------------------------------ Copy rconsoleprint( text) Prints `text` to the console window. Does not clear existing text or create a new line. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsolewarn) rconsolewarn ---------------------------------------------------------------------------------------------- Copy rconsolewarn( text) Prints `text` as a warning to the console window. Does not clear existing text or create a new line. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsoleerror) rconsoleerror ------------------------------------------------------------------------------------------------ Copy rconsoleerror( text) Prints `text` as an error to the console window. Does not clear existing text or create a new line. * * * [hashtag](https://potassium.gitbook.io/api/environment/console#rconsolesettitle) rconsolesettitle ------------------------------------------------------------------------------------------------------ Copy rconsolesettitle( title) ~Sets the title of the console window to~ `~title~`~.~ ⚠️ This function is disabled. * * * [PreviousClosureschevron-left](https://potassium.gitbook.io/api/environment/closures) [NextCryptchevron-right](https://potassium.gitbook.io/api/environment/crypt) Last updated 1 year ago --- # Metatable | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/metatable#getrawmetatable) getrawmetatable ------------------------------------------------------------------------------------------------------ Copy getrawmetatable(
object) Returns the metatable of `object`, where the `__metatable` field would normally lock the metatable. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#hookmetamethod) hookmetamethod ---------------------------------------------------------------------------------------------------- Copy hookmetamethod(
object, method, hook) Replaces `func` with `hook` internally, where `hook` will be invoked in place of `func` when called. Returns a new function that can be used to access the original definition of `func`. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#getnamecallmethod) getnamecallmethod ---------------------------------------------------------------------------------------------------------- Copy getnamecallmethod() Returns the name of the method that invoked the `__namecall` metamethod. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#setnamecallmethod) setnamecallmethod ---------------------------------------------------------------------------------------------------------- Copy setnamecallmethod( method) Changes the name of the method that invoked `__namecall` metamethod. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#isreadonly) isreadonly -------------------------------------------------------------------------------------------- Copy isreadonly(
object) Returns whether `object` is read-only or not. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#setrawmetatable) setrawmetatable ------------------------------------------------------------------------------------------------------ Copy setrawmetatable(
object,
metatable) Sets the metatable of `object` to `metatable`, where the `__metatable` field would normally lock the metatable. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#setreadonly) setreadonly ---------------------------------------------------------------------------------------------- Copy setreadonly(
object, readonly) Sets whether `object` is read-only or not. * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#makewriteable) makewriteable -------------------------------------------------------------------------------------------------- Copy makewriteable(
object) Unfreezes `object` . * * * [hashtag](https://potassium.gitbook.io/api/environment/metatable#makereadonly) makereadonly ------------------------------------------------------------------------------------------------ Copy makereadonly(
object) Freezes `object` , where table.freeze would normally check for \_\_metatable. * * * [PreviousInstancechevron-left](https://potassium.gitbook.io/api/environment/instance) [NextMiscellaneouschevron-right](https://potassium.gitbook.io/api/environment/miscellaneous) Last updated 1 year ago --- # Input | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/input#isrbxactive) isrbxactive ------------------------------------------------------------------------------------------ Copy isrbxactive() Returns whether the game's window is in focus. Must be true for other input functions to work. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse1click) mouse1click ------------------------------------------------------------------------------------------ Copy mouse1click() Dispatches a left mouse button click. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse1press) mouse1press ------------------------------------------------------------------------------------------ Copy mouse1press() Dispatches a left mouse button press. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse1release) mouse1release ---------------------------------------------------------------------------------------------- Copy mouse1release() Dispatches a left mouse button release. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse2click) mouse2click ------------------------------------------------------------------------------------------ Copy mouse2click() Dispatches a right mouse button click. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse2press) mouse2press ------------------------------------------------------------------------------------------ Copy mouse2press() Dispatches a right mouse button press. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mouse2release) mouse2release ---------------------------------------------------------------------------------------------- Copy mouse2release() Dispatches a right mouse button release. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mousemoveabs) mousemoveabs -------------------------------------------------------------------------------------------- Copy mousemoveabs( x, y) Moves the mouse cursor to the specified absolute position. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mousemoverel) mousemoverel -------------------------------------------------------------------------------------------- Copy mousemoverel( x, y) Adjusts the mouse cursor by the specified relative amount. * * * [hashtag](https://potassium.gitbook.io/api/environment/input#mousescroll) mousescroll ------------------------------------------------------------------------------------------ Copy mousescroll( pixels) Dispatches a mouse scroll by the specified number of pixels. * * * [PreviousFile Systemchevron-left](https://potassium.gitbook.io/api/environment/file-system) [NextInstancechevron-right](https://potassium.gitbook.io/api/environment/instance) Last updated 1 year ago --- # File System | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/file-system#readfile) readfile ------------------------------------------------------------------------------------------ Copy readfile( path) Returns the contents of the file located at `path`. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#listfiles) listfiles -------------------------------------------------------------------------------------------- Copy > listfiles( path) Returns a list of files and folders in the folder located at `path`. The returned list contains whole paths. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#writefile) writefile -------------------------------------------------------------------------------------------- Copy writefile( path, data) Writes `data` to the file located at `path` if it is not a folder. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#makefolder) makefolder ---------------------------------------------------------------------------------------------- Copy makefolder( path) Creates a folder at `path` if it does not already exist. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#appendfile) appendfile ---------------------------------------------------------------------------------------------- Copy appendfile( path, data) Appends `data` to the end of the file located at `path`. Creates the file if it does not exist. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#isfile) isfile -------------------------------------------------------------------------------------- Copy isfile( path) Returns whether or not `path` points to a file. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#isfolder) isfolder ------------------------------------------------------------------------------------------ Copy isfolder( path) Returns whether or not `path` points to a folder. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#delfile) delfile ---------------------------------------------------------------------------------------- Copy delfile( path) Removes the file located at `path`. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#delfolder) delfolder -------------------------------------------------------------------------------------------- Copy delfolder( path) Removes the folder located at `path`. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#loadfile) loadfile ------------------------------------------------------------------------------------------ Copy loadfile( path, chunkname) Generates a chunk from the file located at `path`. The environment of the returned function is the global environment. If there are no compilation errors, the chunk is returned by itself; otherwise, it returns `nil` plus the error message. `chunkname` is used as the chunk name for error messages and debug information. * * * [hashtag](https://potassium.gitbook.io/api/environment/file-system#dofile) dofile -------------------------------------------------------------------------------------- Copy dofile( path) Attempts to load the file located at `path` and execute it on a new thread. * * * [PreviousDrawingchevron-left](https://potassium.gitbook.io/api/environment/drawing) [NextInputchevron-right](https://potassium.gitbook.io/api/environment/input) Last updated 1 year ago --- # Drawing | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/drawing#drawing.new) Drawing.new -------------------------------------------------------------------------------------------- Copy Drawing.new( type) Create a new drawing object of the specified type. chevron-rightObjects[hashtag](https://potassium.gitbook.io/api/environment/drawing#objects) [hashtag](https://potassium.gitbook.io/api/environment/drawing#drawingobject) DrawingObject ------------------------------------------------------------------------------------------------ ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#basedrawingobject) BaseDrawingObject Property Type Visible boolean ZIndex number Transparency number Color Color3 Destroy function ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#line) Line Property Type From Vector2 To Vector2 Thickness number ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#text) Text Property Type Text string TextBounds Vector2 Font number Size number Position Vector2 Center boolean Outline boolean OutlineColor Color3 ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#image) Image Property Type Data string Size Vector2 Position Vector2 Rounding number ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#circle) Circle Property Type NumSides number Radius number Position Vector2 Thickness number Filled boolean ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#square) Square Property Type Size Vector2 Position Vector2 Thickness number Filled boolean ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#quad) Quad Property Type PointA Vector2 PointB Vector2 PointC Vector2 PointD Vector2 Thickness number Filled boolean ### [hashtag](https://potassium.gitbook.io/api/environment/drawing#triangle) Triangle Property Type PointA Vector2 PointB Vector2 PointC Vector2 Thickness number Filled boolean * * * [hashtag](https://potassium.gitbook.io/api/environment/drawing#drawing.fonts) Drawing.Fonts ------------------------------------------------------------------------------------------------ Index Value UI 0 System 1 Plex 2 Monospace 3 * * * [hashtag](https://potassium.gitbook.io/api/environment/drawing#cleardrawcache) cleardrawcache -------------------------------------------------------------------------------------------------- Copy cleardrawcache() Destroys every drawing object in the cache. Invalidates references to the drawing objects. * * * [hashtag](https://potassium.gitbook.io/api/environment/drawing#getrenderproperty) getrenderproperty -------------------------------------------------------------------------------------------------------- Copy getrenderproperty( drawing, property) Gets the value of a property of a drawing. Functionally identical to `drawing[property]`. * * * [hashtag](https://potassium.gitbook.io/api/environment/drawing#isrenderobj) isrenderobj -------------------------------------------------------------------------------------------- Copy isrenderobj( object) Returns whether the given object is a valid Drawing. * * * [hashtag](https://potassium.gitbook.io/api/environment/drawing#setrenderproperty) setrenderproperty -------------------------------------------------------------------------------------------------------- Copy setrenderproperty( drawing, property, value) Sets the value of a property of a drawing. Functionally identical to `drawing[property] = value`. * * * [PreviousDebugchevron-left](https://potassium.gitbook.io/api/environment/debug) [NextFile Systemchevron-right](https://potassium.gitbook.io/api/environment/file-system) Last updated 1 year ago --- # Scripts | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/scripts#getgc) getgc -------------------------------------------------------------------------------- Copy > getgc( includetables) Returns a list of objects in the Luau garbage collector. If `includeTables` is false, tables will not be included in the list. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getgenv) getgenv ------------------------------------------------------------------------------------ Copy > getgenv() Returns the custom global environment of the executor. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#gettenv) gettenv ------------------------------------------------------------------------------------ Copy gettenv( thread) Returns the environment of `thread`. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getreg) getreg ---------------------------------------------------------------------------------- Copy > getreg() Returns the lua registry. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getloadedmodules) getloadedmodules ------------------------------------------------------------------------------------------------------ Copy > getloadedmodules() Returns a list of ModuleScripts that have been loaded. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getrenv) getrenv ------------------------------------------------------------------------------------ Copy > getrenv() Returns the global environment of the game client. It can be used to access the global functions that LocalScripts and ModuleScripts use. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getrunningscripts) getrunningscripts -------------------------------------------------------------------------------------------------------- Copy > getrunningscripts() Returns a list of scripts that are currently running. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getscriptbytecode) getscriptbytecode -------------------------------------------------------------------------------------------------------- Copy getscriptbytecode( script) Returns the raw Luau bytecode of the given script. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getscriptclosure) getscriptclosure ------------------------------------------------------------------------------------------------------ Copy getscriptclosure( script) Generates a new closure using the bytecode of `script`. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getscripthash) getscripthash ------------------------------------------------------------------------------------------------ Copy getscripthash( script) Returns a SHA384 hash of the script's bytecode. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getscripts) getscripts ------------------------------------------------------------------------------------------ Copy > getscripts() Returns a list of every script in the game. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getsenv) getsenv ------------------------------------------------------------------------------------ Copy > getsenv( script) Returns the global environment of the given script. It can be used to access variables and functions that are not defined as local. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#getthreadidentity) getthreadidentity -------------------------------------------------------------------------------------------------------- Copy getthreadidentity() Returns the identity of the current thread. * * * [hashtag](https://potassium.gitbook.io/api/environment/scripts#setthreadidentity) setthreadidentity -------------------------------------------------------------------------------------------------------- Copy setthreadidentity( identity) Sets the current thread identity. * * * [PreviousMiscellaneouschevron-left](https://potassium.gitbook.io/api/environment/miscellaneous) [NextWeb Socketschevron-right](https://potassium.gitbook.io/api/environment/web-sockets) Last updated 1 year ago --- # Instance | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/instance#fireclickdetector) fireclickdetector --------------------------------------------------------------------------------------------------------- Copy fireclickdetector( object, distance) Dispatches a click or hover event to the given ClickDetector. When absent, `distance` defaults to zero. Copy local clickDetector = workspace.Door.Button.ClickDetector fireclickdetector(clickDetector, 10 + math.random()) * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#firetouchinterest) firetouchinterest --------------------------------------------------------------------------------------------------------- Copy firetouchinterest( instance, touchingPart, isTouching) Simulates a touch event between two parts. Copy local rootPart = game.Players.LocalPlayer.Character.HumanoidRootPart firetouchinterest(workspace.TouchPart, rootPart, true) firetouchinterest(workspace.TouchPart, rootPart, false) * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#isnetworkowner) isnetworkowner --------------------------------------------------------------------------------------------------- Copy isnetworkowner( part) Returns `true` if the Part is owned by the player. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getcallbackvalue) getcallbackvalue ------------------------------------------------------------------------------------------------------- Copy getcallbackvalue( object, property) Returns the function assigned to a callback property of `object`, which cannot be indexed normally. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#fireproximityprompt) fireproximityprompt ------------------------------------------------------------------------------------------------------------- Copy fireproximityprompt( prompt) Fires the trigger of `prompt`. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getconnections) getconnections --------------------------------------------------------------------------------------------------- Copy > getconnections( signal) Creates a list of Connection objects for the functions connected to `signal`. Field Type Description `Enabled` boolean Whether the connection can receive events. `ForeignState` boolean Whether the function was connected by a foreign Luau state (i.e. CoreScripts). `LuaConnection` boolean Whether the connection was created in Luau code. `Function` function? The function bound to this connection. Nil when `ForeignState` is true. `Thread` thread? The thread that created the connection. Nil when `ForeignState` is true. Method Description `Fire(...: any): ()` Fires this connection with the provided arguments. `Defer(...: any): ()` [Defersarrow-up-right](https://devforum.roblox.com/t/beta-deferred-lua-event-handling/1240569) an event to connection with the provided arguments. `Disconnect(): ()` Disconnects the connection. `Disable(): ()` Prevents the connection from firing. `Enable(): ()` Allows the connection to fire if it was previously disabled. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getconnection) getconnection ------------------------------------------------------------------------------------------------- Copy > getconnection( signal, index) Returns a Connection object for `index` . * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#firesignal) firesignal ------------------------------------------------------------------------------------------- Copy firesignal( signal, ...) Fires all Lua connections of `signal` . * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getcustomasset) getcustomasset --------------------------------------------------------------------------------------------------- Copy getcustomasset( path) Returns a `rbxasset://` content id for the asset located at `path`, allowing you to use unmoderated assets. Internally, files are copied to the game's content directory. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#gethiddenproperty) gethiddenproperty --------------------------------------------------------------------------------------------------------- Copy gethiddenproperty( object, property) Returns the value of a hidden property of `object`, which cannot be indexed normally. If the property is hidden, the second return value will be `true`. Otherwise, it will be `false`. Copy local fire = Instance.new("Fire") print(gethiddenproperty(fire, "size_xml")) --> 5, true print(gethiddenproperty(fire, "Size")) --> 5, false * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#setsimulationradius) setsimulationradius ------------------------------------------------------------------------------------------------------------- Copy setsimulationradius( simulationRadius, maxSimulationRadius) Sets the player's simulationRadius. If `maxSimulationRadius` is specified, it will set that as well. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#gethui) gethui ----------------------------------------------------------------------------------- Copy gethui() Returns a hidden GUI container. Should be used as an alternative to CoreGui and PlayerGui. GUI objects parented to this container will be protected from common detection methods. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getinstances) getinstances ----------------------------------------------------------------------------------------------- Copy > getinstances() Returns a list of every Instance referenced on the client. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getnilinstances) getnilinstances ----------------------------------------------------------------------------------------------------- Copy > getnilinstances() Like `getinstances`, but only includes Instances that are not descendants of a service provider. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#isscriptable) isscriptable ----------------------------------------------------------------------------------------------- Copy isscriptable( object, property) Returns whether the given property is scriptable (does not have the `notscriptable` tag). If `true`, the property is scriptable and can be indexed normally. If `nil`, the property does not exist. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#sethiddenproperty) sethiddenproperty --------------------------------------------------------------------------------------------------------- Copy sethiddenproperty( object, property, value) Sets the value of a hidden property of `object`, which cannot be set normally. Returns whether the property was hidden. Copy local fire = Instance.new("Fire") print(sethiddenproperty(fire, "Size", 5)) --> false (not hidden) print(sethiddenproperty(fire, "size_xml", 15)) --> true (hidden) print(gethiddenproperty(fire, "size_xml")) --> 15, true (hidden) * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#setrbxclipboard) setrbxclipboard ----------------------------------------------------------------------------------------------------- Copy setrbxclipboard( data) Sets the Studio client's clipboard to the given `rbxm` or `rbxmx` model data. This allows data from the game to be copied into a Studio client. Copy local data = readfile("model.rbxm") setrbxclipboard(data) -- Can be pasted into Studio * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#setscriptable) setscriptable ------------------------------------------------------------------------------------------------- Copy setscriptable( object, property, value) Set whether the given property is scriptable. Returns whether the property was scriptable prior to changing it. * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#getrendersteppedlist) getrendersteppedlist --------------------------------------------------------------------------------------------------------------- Copy
getrendersteppedlist() Returns all callbacks bound with `RunService.BindToRenderStep` . * * * [hashtag](https://potassium.gitbook.io/api/environment/instance#replicatesignal) replicatesignal ----------------------------------------------------------------------------------------------------- Copy replicatesignal( signal, ...) Replicates `signal` on the server. If `signal` has one or multiple arguments, they must be provided in the call. Copy replicatesignal(game.Players.LocalPlayer.Kill) --> Kills you local sword = game.Players.LocalPlayer.Character.ClassicSword replicatesignal(sword.Activated) --> Swings the sword * * * [PreviousInputchevron-left](https://potassium.gitbook.io/api/environment/input) [NextMetatablechevron-right](https://potassium.gitbook.io/api/environment/metatable) Last updated 1 year ago --- # Miscellaneous | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#identifyexecutor) identifyexecutor ------------------------------------------------------------------------------------------------------------ Copy identifyexecutor() Returns the name and version of Potassium. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#lz4compress) lz4compress -------------------------------------------------------------------------------------------------- Copy lz4compress( data) Compresses `data` using LZ4 compression. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#lz4decompress) lz4decompress ------------------------------------------------------------------------------------------------------ Copy lz4compress( data, size) Decompresses `data` using LZ4 compression, with the decompressed size specified by `size`. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#messagebox) messagebox ------------------------------------------------------------------------------------------------ Copy messagebox( text, caption, flags) Creates a message box with the specified text, caption, and flags. Yields until the message box is closed, and returns the user input code. * * * * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#queue_on_teleport) queue\_on\_teleport ---------------------------------------------------------------------------------------------------------------- Copy queue_on_teleport( code) Queues the specified script to be executed after the player teleports to a different place. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#request) request ------------------------------------------------------------------------------------------ Copy request( options) Sends an HTTP request using the specified options. Yields until the request is complete, and returns the response. Field Type Description Url string The URL for the request. Method string The HTTP method to use. Body string? The body of the request. Headers table? A table of headers. Cookies table? A table of cookies. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#getinternalparent) getinternalparent -------------------------------------------------------------------------------------------------------------- Copy getinternalparent( instance) Returns the internal parent field of the `instance`. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#getfflag) getfflag -------------------------------------------------------------------------------------------- Copy getfflag( fflag) Returns the value of `fflag` * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#setfflag) setfflag -------------------------------------------------------------------------------------------- Copy setfflag( fflag, value) Sets the value of `fflag` to `value` * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#setinternalparent) setinternalparent -------------------------------------------------------------------------------------------------------------- Copy setinternalparent( instance, newparent) Sets the internal parent field of `instance` to `newparent` * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#setclipboard) setclipboard ---------------------------------------------------------------------------------------------------- Copy setclipboard( text) Copies `text` to the clipboard. * * * [hashtag](https://potassium.gitbook.io/api/environment/miscellaneous#setfpscap) setfpscap ---------------------------------------------------------------------------------------------- Copy setfpscap( fps) Sets the in-game FPS cap to `fps`. If `fps` is 0, the FPS cap is disabled. * * * [PreviousMetatablechevron-left](https://potassium.gitbook.io/api/environment/metatable) [NextScriptschevron-right](https://potassium.gitbook.io/api/environment/scripts) Last updated 1 year ago --- # Actor | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/actor#create_comm_channel) create\_comm\_channel ------------------------------------------------------------------------------------------------------------ Copy create_comm_channel() Returns the channel and the associated ID. * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#get_comm_channel) get\_comm\_channel ------------------------------------------------------------------------------------------------------ Copy get_comm_channel( id) Returns the communication channel if it exists. * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#run_on_actor) run\_on\_actor ---------------------------------------------------------------------------------------------- Copy run_on_actor( actor, script, ...) Runs a script on an actor thread. Copy run_on_actor(getactors()[1], [[\ print("Hello, world!")\ ]]) * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#getactors) getactors -------------------------------------------------------------------------------------- Copy > getactors() Returns a table of all actors that exist within the game. * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#is_parallel) is\_parallel ------------------------------------------------------------------------------------------- Copy is_parallel() Returns if the thread is running on an actor. * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#run_on_thread) run\_on\_thread ------------------------------------------------------------------------------------------------ Copy run_on_thread( thread, script, ...) Runs a script on a specified thread, actor threads only. Copy run_on_thread(getactorthreads()[1], [[\ print("Hello, world!")\ ]]) * * * [hashtag](https://potassium.gitbook.io/api/environment/actor#getactorthreads) getactorthreads -------------------------------------------------------------------------------------------------- Copy > getactorthreads() Returns all threads that belong to actors in a table. * * * [PreviousWeb Socketschevron-left](https://potassium.gitbook.io/api/environment/web-sockets) Last updated 1 year ago --- # Web Sockets | Potassium API [hashtag](https://potassium.gitbook.io/api/environment/web-sockets#websocket.connect) WebSocket.connect ------------------------------------------------------------------------------------------------------------ Copy WebSocket.connect( url) Establishes a WebSocket connection to the specified URL. Copy local ws = WebSocket.connect("ws://localhost:8080") ws.OnMessage:Connect(function(message) print(message) end) ws.OnClose:Connect(function() print("Closed") end) ws:Send("Hello, World!") * * * [hashtag](https://potassium.gitbook.io/api/environment/web-sockets#websocketconnection) WebSocketConnection ---------------------------------------------------------------------------------------------------------------- Copy ws = WebSocket.connect(url) ### [hashtag](https://potassium.gitbook.io/api/environment/web-sockets#methods) Methods Method Description Copy Send( message) Sends a message over the WebSocket connection Copy Close() Closes the WebSocket connection ### [hashtag](https://potassium.gitbook.io/api/environment/web-sockets#events) Events Event Description Copy OnMessage( message) Fired when a message is received over the WebSocket connection Copy OnClose() Fired when the WebSocket connection is closed * * * [PreviousScriptschevron-left](https://potassium.gitbook.io/api/environment/scripts) [NextActorchevron-right](https://potassium.gitbook.io/api/environment/actor) Last updated 1 year ago --- # Cache | Potassium API [hashtag](https://potassium.gitbook.io/api/environment#cache.invalidate) cache.invalidate ---------------------------------------------------------------------------------------------- Copy cache.invalidate( object) Deletes `object` from the Instance cache. Effectively invalidates `object` as a reference to the underlying Instance. * * * [hashtag](https://potassium.gitbook.io/api/environment#cache.iscached) cache.iscached ------------------------------------------------------------------------------------------ Copy cache.iscached( object) Checks whether `object` exists in the Instance cache. * * * [hashtag](https://potassium.gitbook.io/api/environment#cache.replace) cache.replace ---------------------------------------------------------------------------------------- Copy cache.replace( object, newobject) Replaces `object` in the Instance cache with `newObject`. * * * [hashtag](https://potassium.gitbook.io/api/environment#cloneref) cloneref ------------------------------------------------------------------------------ Copy cloneref( object) Returns a copy of the Instance reference to `object`. This is useful for managing an Instance without directly referencing it. * * * [hashtag](https://potassium.gitbook.io/api/environment#compareinstances) compareinstances ---------------------------------------------------------------------------------------------- Copy compareinstances( a, b) Returns whether objects `a` and `b` both reference the same Instance. * * * [NextClosureschevron-right](https://potassium.gitbook.io/api/environment/closures) Last updated 1 year ago ---