evasivedocs
Roblox scriptingLuau 0.748 · 24 guides · 385 API entries
API reference

Memory and the Lua heap

Reading and writing the client's memory and its Luau tables.

Memory

Read and write the Roblox client's memory. Needs Allow unsafe Luau, in Scripts > Settings > Security. It is off by default, and while it is off each function raises "<name> requires 'Allow unsafe Luau' (Scripts settings)" before it reads or writes anything. Addresses are plain numbers. They are exact below 2^53, and every address evasive gives you is.

4 entries

MemoryType

typeAllow unsafe Luau
MemoryType = "byte" | "int" | "float" | "double" | "uintptr_t" | "string"

The type names memory_read and memory_write take.

Fields
NameTypeDescription
bytenumber1 byte, 0 to 255.
intnumber4 bytes, signed.
floatnumber4-byte float.
doublenumber8-byte float.
uintptr_tnumber8 bytes, unsigned: an address. A value over 2^53 arrives rounded.
stringstringRead: the bytes up to the first unprintable one. Write: the bytes and a terminating NUL.

Needs Allow unsafe Luau in Scripts > Settings (off by default).

getbase

functionAllow unsafe Luau
getbase() -> number

The base address of the Roblox client's module (RobloxPlayerBeta.exe). Add an offset to it to get an absolute address.

Returns
  • number

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
local base = getbase()
print(string.format("%X", base))

memory_read

functionAllow unsafe Luau
memory_read(memoryType, address) -> any

Reads a value of memoryType at address. An address that cannot be read gives 0.

Arguments
NameTypeDescription
memoryTypestringA MemoryType name.
addressnumberAn absolute address.
Returns
  • any

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
local hp = memory_read("float", base + 0x1A2B3C)

memory_write

functionAllow unsafe Luau
memory_write(memoryType, address, value)

Writes value at address as memoryType. Check the address and the type first: a wrong write can crash Roblox.

Arguments
NameTypeDescription
memoryTypestringA MemoryType name.
addressnumberAn absolute address.
valueanyA number, or a string for "string".

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
memory_write("float", addr, 100)

Garbage collector

Find values the game keeps in its Luau tables by key name (weapon stats, cooldowns) and change them. Needs Allow unsafe Luau.

3 entries

getgc

functionAllow unsafe Luau
getgc(names) -> { table }

Searches the game's Luau heap for table entries whose key is one of names, and returns them as a list: a cache for applygc. The same key often sits in several tables, so several entries are normal. Nothing found gives an empty table. A search takes about two seconds and yields meanwhile, so do it once and keep the result. At most 4096 entries.

Arguments
NameTypeDescription
namesstring | { string }
Fields
NameTypeDescription
keystringThe key it was found under.
valueanyThe value when it was found.
typestringnumber, boolean, string, table, function, ...
addrnumberWhere the value is stored.
Returns
  • { table }

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
local cache = getgc({ "FireRate", "MagAmmo" })
print(#cache)

setgc

functionWorks differentlyAllow unsafe Luau
setgc(key [, value]) -> number

Searches the heap again and sets every entry under key whose type matches value's, and returns how many it set. Pass a table to set several keys in one search. Every call searches, so never call it in a loop: use getgc once and applygc.

Note

A string value is never written: the client runs several Luau states, and a string stored from outside could land in another one's table. Matching slots are skipped, left out of the count and named on the console. Numbers and booleans are written.

Arguments
NameTypeDescription
keystring | { [string]: any }
valueoptionalany
Returns
  • number

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
setgc("FireRate", 0)
setgc({ FireRate = 0, SpreadAngle = 0 })

applygc

functionWorks differentlyAllow unsafe Luau
applygc(cache, key [, value]) -> number

Like setgc, over a cache from getgc and without a new search: under a millisecond for a few entries, so it can run every frame. Search again after the game rebuilds its tables (a respawn, another weapon). A cache over 4096 entries is refused.

Note

A string value is never written: the client runs several Luau states, and a string stored from outside could land in another one's table. Matching slots are skipped, left out of the count and named on the console. Numbers and booleans are written.

Arguments
NameTypeDescription
cache{ table }
keystring | { [string]: any }
valueoptionalany
Returns
  • number

Needs Allow unsafe Luau in Scripts > Settings (off by default).

Example
Luau
local cache = getgc({ "FireRate", "MagAmmo" })
applygc(cache, { FireRate = 0, MagAmmo = 999 })