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.
MemoryType = "byte" | "int" | "float" | "double" | "uintptr_t" | "string"The type names memory_read and memory_write take.
| Name | Type | Description |
|---|---|---|
byte | number | 1 byte, 0 to 255. |
int | number | 4 bytes, signed. |
float | number | 4-byte float. |
double | number | 8-byte float. |
uintptr_t | number | 8 bytes, unsigned: an address. A value over 2^53 arrives rounded. |
string | string | Read: 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() -> numberThe base address of the Roblox client's module (RobloxPlayerBeta.exe). Add an offset to it to get an absolute address.
number
Needs Allow unsafe Luau in Scripts > Settings (off by default).
local base = getbase()
print(string.format("%X", base))memory_read(memoryType, address) -> anyReads a value of memoryType at address. An address that cannot be read gives 0.
| Name | Type | Description |
|---|---|---|
memoryType | string | A MemoryType name. |
address | number | An absolute address. |
any
Needs Allow unsafe Luau in Scripts > Settings (off by default).
local hp = memory_read("float", base + 0x1A2B3C)memory_write(memoryType, address, value)Writes value at address as memoryType. Check the address and the type first: a wrong write can crash Roblox.
| Name | Type | Description |
|---|---|---|
memoryType | string | A MemoryType name. |
address | number | An absolute address. |
value | any | A number, or a string for "string". |
Needs Allow unsafe Luau in Scripts > Settings (off by default).
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.
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.
| Name | Type | Description |
|---|---|---|
names | string | { string } |
| Name | Type | Description |
|---|---|---|
key | string | The key it was found under. |
value | any | The value when it was found. |
type | string | number, boolean, string, table, function, ... |
addr | number | Where the value is stored. |
{ table }
Needs Allow unsafe Luau in Scripts > Settings (off by default).
local cache = getgc({ "FireRate", "MagAmmo" })
print(#cache)setgc(key [, value]) -> numberSearches 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.
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.
| Name | Type | Description |
|---|---|---|
key | string | { [string]: any } | |
valueoptional | any |
number
Needs Allow unsafe Luau in Scripts > Settings (off by default).
setgc("FireRate", 0)
setgc({ FireRate = 0, SpreadAngle = 0 })applygc(cache, key [, value]) -> numberLike 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.
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.
| Name | Type | Description |
|---|---|---|
cache | { table } | |
key | string | { [string]: any } | |
valueoptional | any |
number
Needs Allow unsafe Luau in Scripts > Settings (off by default).
local cache = getgc({ "FireRate", "MagAmmo" })
applygc(cache, { FireRate = 0, MagAmmo = 999 })