├── Libraries ├── Closures.md ├── Cryptography.md ├── Debug.md ├── Drawing.md ├── Environment.md ├── Filesystem.md ├── Instances.md ├── Metatables.md ├── Miscellaneous.md ├── Reflection.md ├── Scripts.md ├── Signals.md └── WebSocket.md └── README.md /Libraries/Closures.md: -------------------------------------------------------------------------------- 1 | Functions that allow **inspection/modification/creation** of Luau closures 2 | 3 | --- 4 | 5 | ## hookfunction 6 | 7 | Hooks a function with another wanted function, returning the original unhooked function. 8 | 9 | > [!Note] 10 | > The hook shouldn't have more upvalues than the function you want to hook. 11 | > 12 | > All possible hooking closure pairs should be supported throughout L, NC, C. (NC = newcclosure) 13 | 14 | ```luau 15 | function hookfunction(function_to_hook: (A1...) -> R1..., hook: (A1...) -> R1...): (A1...) -> R1... 16 | ``` 17 | 18 | ### Parameters 19 | 20 | - `function_to_hook` - The function that will be hooked 21 | - `hook` - The function that will be used as a hook 22 | 23 | ### Example 24 | 25 | ```luau 26 | local function DummyFunction() 27 | print("I am not hooked!") 28 | end 29 | 30 | local function DummyHook() 31 | print("I am hooked!") 32 | end 33 | 34 | DummyFunction() -- Output: I am not hooked! 35 | 36 | local OldFunction = hookfunction(DummyFunction, DummyHook) 37 | 38 | DummyFunction() -- Output: I am hooked! 39 | OldFunction() -- Output: I am not hooked! 40 | ``` 41 | 42 | --- 43 | 44 | ## hookmetamethod 45 | 46 | This function takes any lua value that can have metatable and attempts to hook the specified metamethod of the lua value with the `hookfunction` function. 47 | 48 | Function can be safely implemented in Lua if `hookfunction` is properly implemented in C code. 49 | ```luau 50 | function hookmetamethod(object: {[any]: any} | Instance | userdata, metamethod_name: string, hook: (...any) -> (...any)): (...any) -> (...any) 51 | ``` 52 | 53 | ### Parameter 54 | 55 | - `object` - The object which has the metatable. 56 | - `metamethod_name` - The name of the metamethod to hook. 57 | - `hook` - The function that will be used as a hook. 58 | 59 | ### Example 60 | ```luau 61 | local Original; Original = hookmetamethod(game, "__index", function(...) 62 | local Key = select(2, ...) 63 | print(Key) 64 | return Original(...) 65 | end) 66 | 67 | local _ = game.PlaceId 68 | hookmetamethod(game, "__index", Original) -- Restores game's __index 69 | 70 | -- Output: PlaceId 71 | ``` 72 | 73 | --- 74 | 75 | ## newcclosure 76 | 77 | > [!WARNING] 78 | > Many executors are implementing this function using `coroutine` functions in Lua; these implementations won't pass sUNC checks. 79 | > 80 | > The wrapped function should be yieldable (meaning that the function should be able to call `task.wait`, for example) 81 | 82 | This function takes in a function and wraps it into a C closure. 83 | 84 | When the returned function is called, the original Lua closure is called, and arguments are passed to the original closure, and then the original closure returned arguments are passed to the caller of the C closure. 85 | 86 | ```luau 87 | function newcclosure(function_to_wrap: (A...) -> R...): (A...) -> R... 88 | ``` 89 | 90 | ### Parameter 91 | 92 | - `function_to_wrap` - A function to be wrapped. 93 | 94 | ### Example 95 | 96 | ```luau 97 | local DummyFunction = function(...) 98 | return ... 99 | end 100 | 101 | print(iscclosure(DummyFunction)) -- Output: false 102 | 103 | local WrappedFunction = newcclosure(DummyFunction) 104 | 105 | print(iscclosure(WrappedFunction)) -- Output: true 106 | 107 | local FunctionResults = WrappedFunction("Hello") 108 | print(FunctionResults) -- Output: Hello 109 | ``` 110 | 111 | ```luau 112 | local DummyYieldingFunction = newcclosure(function() 113 | print("Before") 114 | task.wait(1.5) 115 | print("After") 116 | end) 117 | 118 | DummyYieldingFunction() 119 | -- Output: 120 | -- Before 121 | -- yield for 1.5 seconds 122 | -- After 123 | ``` 124 | 125 | --- 126 | 127 | ## iscclosure 128 | 129 | Checks if a given function is a C closure. 130 | 131 | ```luau 132 | function iscclosure(func: (...any) -> (...any)): boolean 133 | ``` 134 | 135 | ### Parameter 136 | 137 | - `func` - The function to check. 138 | 139 | ### Example 140 | 141 | ```luau 142 | local function DummyLuaFunction() 143 | print("This is an executor Lua closure") 144 | end 145 | 146 | local DummyCFunction = newcclosure(function() 147 | print("This is an Executor C Closure") 148 | end) 149 | 150 | local DummyStandardCFunction = print 151 | local DummyGlobalCFunction = getgc 152 | 153 | print(iscclosure(DummyCFunction)) -- Output: true 154 | print(iscclosure(DummyGlobalCFunction)) -- Output: true 155 | print(iscclosure(DummyStandardCFunction)) -- Output: true 156 | print(iscclosure(DummyLuaFunction)) -- Output: false 157 | ``` 158 | 159 | --- 160 | 161 | ## islclosure 162 | 163 | Checks if a given function is a L closure. 164 | 165 | ```luau 166 | function islclosure(func: (...any) -> (...any)): boolean 167 | ``` 168 | 169 | ### Parameter 170 | 171 | - `func` - The function to check. 172 | 173 | ### Example 174 | 175 | ```luau 176 | local function DummyLuaFunction() 177 | print("This is an executor Lua closure") 178 | end 179 | 180 | local DummyCFunction = newcclosure(function() 181 | print("This is an executor C closure") 182 | end) 183 | 184 | local DummyStandardCFunction = print 185 | 186 | print(islclosure(DummyLuaFunction)) -- Output: true 187 | print(islclosure(DummyStandardCFunction)) -- Output: false 188 | print(islclosure(DummyCFunction)) -- Output: false 189 | ``` 190 | 191 | --- 192 | 193 | ## isexecutorclosure 194 | 195 | Checks if a given function is the executor's closure. 196 | 197 | ```luau 198 | function isexecutorclosure(func: (...any) -> (...any)): boolean 199 | ``` 200 | 201 | ### Parameter 202 | 203 | - `func` - The function to check. 204 | 205 | ### Example 206 | 207 | ```luau 208 | local function DummyLuaFunction() 209 | print("This is an executor Lua closure") 210 | end 211 | 212 | local DummyCFunction = newcclosure(function() 213 | print("This is an executor C closure") 214 | end) 215 | 216 | local DummyStandardCFunction = print 217 | local DummyGlobalCFunction = getgc 218 | 219 | print(isexecutorclosure(DummyLuaFunction)) -- Output: true 220 | print(isexecutorclosure(DummyCFunction)) -- Output: true 221 | print(isexecutorclosure(DummyGlobalCFunction)) -- Output: true 222 | print(isexecutorclosure(DummyStandardCFunction)) -- Output: false 223 | ``` 224 | 225 | --- 226 | 227 | ## clonefunction 228 | 229 | Creates and returns a new function that has the same behaviour as the passed function. 230 | > [!NOTE] 231 | > The cloned function must have the same environment as the original. 232 | > 233 | > Any sort of modification to the original shouldn't affect the clone. Meaning that stuff like hooking the original will leave the clone unaffected. 234 | 235 | ```luau 236 | function clonefunction(function_to_clone: (A...) -> R...): (A...) -> R... 237 | ``` 238 | 239 | ### Parameter 240 | 241 | - `func` - The function to clone. 242 | 243 | ### Example 244 | 245 | ```luau 246 | local function DummyFunction() 247 | print("Hello") 248 | end 249 | 250 | local ClonedFunction = clonefunction(DummyFunction) 251 | 252 | print(debug.info(ClonedFunction, "l")) -- Output: 1 253 | print(debug.info(ClonedFunction, "n")) -- Output: DummyFunction 254 | print(ClonedFunction == DummyFunction) -- Output: false 255 | print(getfenv(ClonedFunction) == getfenv(DummyFunction)) -- Output: true 256 | ``` 257 | 258 | --- 259 | 260 | ## getfunctionhash 261 | 262 | Returns the ***hex-represented*** [SHA-384 hash](https://en.wikipedia.org/wiki/SHA-3) of a provided function's instructions (code) and constants. 263 | 264 | ```luau 265 | function getfunctionhash(function_to_hash: (...any) -> (...any)): string 266 | ``` 267 | 268 | ### Example 269 | 270 | ```luau 271 | local function isSHA384Hex(hash) 272 | if #hash ~= 96 then 273 | return false 274 | end 275 | if not hash:match("^[0-9a-fA-F]+$") then 276 | return false 277 | end 278 | return true 279 | end 280 | 281 | local DummyFunction0 = function() end 282 | local DummyFunction1 = function(...) end 283 | local DummyFunction2 = function() end 284 | local DummyFunction3 = function() return "Constant" end 285 | local DummyFunction4 = function() return "Constant2" end 286 | 287 | print(isSHA384Hex(getfunctionhash(DummyFunction0))) -- Output: true 288 | print(getfunctionhash(DummyFunction0) == getfunctionhash(DummyFunction1)) -- Output: false 289 | print(getfunctionhash(DummyFunction0) == getfunctionhash(DummyFunction2)) -- Output: true 290 | print(getfunctionhash(DummyFunction3) == getfunctionhash(DummyFunction4)) -- Output: false 291 | ``` 292 | -------------------------------------------------------------------------------- /Libraries/Cryptography.md: -------------------------------------------------------------------------------- 1 | # Cryptography 2 | 3 | Functions made for encrypting and decrypting data. 4 | 5 | --- 6 | 7 | ## crypt.base64encode 8 | 9 | Encodes a string with Base64 encoding. 10 | 11 | ```luau 12 | function crypt.base64encode(data: string): string 13 | ``` 14 | 15 | ### Parameters 16 | 17 | - `data` - The data to encode. 18 | 19 | ### Example 20 | 21 | ```luau 22 | print(crypt.base64encode("DummyString\0\2")) -- Output: RHVtbXlTdHJpbmcAAg== 23 | ``` 24 | 25 | --- 26 | 27 | ## crypt.base64decode 28 | 29 | Decodes a Base64 string into its original form. 30 | 31 | ```luau 32 | function crypt.base64decode(data: string): string 33 | ``` 34 | 35 | ### Parameters 36 | 37 | - `data` - The data to decode. 38 | 39 | ```luau 40 | local bytecode = game:HttpGet("https://rubis-api.numelon.com/v2/scrap/zuxQZuM9Tnl5MRbo/raw") 41 | writefile("sound.mp3", crypt.base64decode(bytecode)) -- This file should be a valid and working mp3 file. 42 | ``` 43 | -------------------------------------------------------------------------------- /Libraries/Debug.md: -------------------------------------------------------------------------------- 1 | # Debug 2 | 3 | Functions that allow us to get **more control** over Luau functions. 4 | 5 | --- 6 | 7 | ## debug.getconstants 8 | 9 | Returns the constants of the specified Lua function. Should error on C closures, since they have no constants. 10 | 11 | ```luau 12 | function debug.getconstants(func: (...any) -> (...any) | number): { number | string | boolean | nil } 13 | ``` 14 | 15 | ### Parameter 16 | 17 | - `func` - The Lua function/level the constants would be obtained from. 18 | 19 | ### Example 20 | 21 | ```luau 22 | local function DummyFunction() 23 | local DummyString = "foo bar" 24 | string.split(DummyString, " ") 25 | end 26 | 27 | local Constants = debug.getconstants(DummyFunction) 28 | for ConstantIndex, Constant in Constants do 29 | print(`[{ConstantIndex}]: {Constant}`) 30 | end 31 | 32 | -- Output: 33 | -- [1]: "string" 34 | -- [2]: "split" 35 | -- [4]: "foo bar" 36 | -- [5]: " " 37 | -- Optimization Level: 1, Debug Level: 1 38 | ``` 39 | 40 | ```luau 41 | print(debug.getconstants(print)) -- Should error due to being a C closure 42 | ``` 43 | 44 | --- 45 | 46 | ## debug.getconstant 47 | 48 | Returns the constant at the specified index. If there is no constant at the specified index, `nil` will be returned instead. 49 | 50 | ```luau 51 | function debug.getconstant(func: (...any) -> (...any) | number, index: number): number | string | boolean | nil 52 | ``` 53 | 54 | ### Parameters 55 | 56 | - `func` - The Lua function/level the constant would be obtained from. 57 | - `index` - Position of the wanted constant. 58 | 59 | ### Examples 60 | 61 | ```luau 62 | local function DummyFunction() 63 | local DummyString = "foo bar" 64 | string.split(DummyString, " ") 65 | end 66 | 67 | local Result = debug.getconstant(DummyFunction, 2) 68 | print(Result) -- Output: string 69 | 70 | -- Optimization Level: 1, Debug Level: 1 71 | ``` 72 | 73 | ```luau 74 | local function DummyFunction() 75 | local DummyString = "foo bar" 76 | string.split(DummyString, " ") 77 | end 78 | 79 | local Result = debug.getconstant(DummyFunction, 3) 80 | print(Result) -- Output: nil 81 | 82 | -- Optimization Level: 1, Debug Level: 1 83 | ``` 84 | 85 | > [!WARNING] 86 | > If `game` is a mutable global, the indexes will be different 87 | 88 | ```luau 89 | print(debug.getconstant(print)) -- Should error due to being a C closure 90 | ``` 91 | 92 | --- 93 | 94 | ## debug.setconstant 95 | 96 | Sets the wanted constant at the specified index. An error will be returned if the index is invalid. 97 | 98 | ```luau 99 | function debug.setconstant(func: (...any) -> (...any) | number, index: number, value: number | string | boolean | nil): () 100 | ``` 101 | 102 | ### Parameters 103 | 104 | - `func` - The Lua function/level whose constant would be set. 105 | - `index` - The position of the constant. 106 | - `value` - New constant replacing the old one. 107 | 108 | ### Example 109 | 110 | ```luau 111 | local function DummyFunction() 112 | print(game.Name) 113 | end 114 | 115 | debug.setconstant(DummyFunction, 4, "Players") 116 | 117 | DummyFunction() -- Output: Players 118 | -- Optimization Level: 1, Debug Level: 1 119 | ``` 120 | 121 | > [!WARNING] 122 | > If `game` is a mutable global, the index will be different 123 | 124 | --- 125 | 126 | ## debug.getupvalues 127 | 128 | Returns the upvalues of the specified function. `nil` will be returned if there is none. 129 | 130 | ```luau 131 | function debug.getupvalues(func: (...any) -> (...any) | number): { any } 132 | ``` 133 | 134 | ### Parameter 135 | 136 | - `func` - The Lua function/level the upvalues would be obtained from. 137 | 138 | ### Examples 139 | 140 | ```luau 141 | local Var1 = false 142 | local Var2 = "Hi" 143 | local function DummyFunction() 144 | Var1 = true 145 | Var2..=", hello" 146 | end 147 | 148 | for UpvalIndex, UpvalValue in pairs(debug.getupvalues(DummyFunction)) do 149 | print(UpvalIndex, UpvalValue) 150 | end 151 | 152 | -- Output: 153 | -- 1 false 154 | -- 2 Hi 155 | ``` 156 | 157 | ```luau 158 | local Var1 = false 159 | local function DummyFunction() 160 | print(Var1) 161 | end 162 | 163 | print(next(debug.getupvalues(DummyFunction))) -- Output: nil 164 | ``` 165 | 166 | ```luau 167 | print(debug.getupvalues(print)) -- Should error due to `print` being a C closure 168 | ``` 169 | 170 | --- 171 | 172 | ## debug.getupvalue 173 | 174 | Returns the upvalue at the specified index. An error should occur if the index is invalid. 175 | 176 | ```luau 177 | function debug.getupvalue(func: (...any) -> (...any) | number, index: number): any 178 | ``` 179 | 180 | ### Parameters 181 | 182 | - `func` - The Lua function/level the upvalue would be obtained from. 183 | - `index` - The position of the wanted upvalue. 184 | 185 | ### Examples 186 | 187 | ```luau 188 | local UpFunction = function() print("Hello from up") end 189 | 190 | local function DummyFunction() 191 | UpFunction() 192 | end 193 | 194 | local Upvalue = debug.getupvalue(DummyFunction, 1) 195 | Upvalue() -- Output: Hello from up 196 | ``` 197 | 198 | ```luau 199 | local function DummyFunction() end 200 | 201 | debug.getupvalue(DummyFunction, 0) -- Should error due to invalid index passage 202 | ``` 203 | 204 | ```luau 205 | debug.getupvalue(print, 1) -- Should error due to invalid index and C closure passage 206 | ``` 207 | 208 | --- 209 | 210 | ## debug.setupvalue 211 | 212 | Replaces the upvalue at the specified index. An error should occur if the index is invalid. 213 | 214 | ```luau 215 | function debug.setupvalue(func: (...any) -> (...any) | number, index: number, value: any): () 216 | ``` 217 | 218 | ### Parameters 219 | 220 | - `func` - The Lua function/level whose upvalue would be set. 221 | - `index` - The position of the wanted upvalue. 222 | - `value` - New upvalue replacing the old one. 223 | 224 | ### Example 225 | 226 | ```luau 227 | local Upvalue = 90 228 | 229 | local function DummyFunction() 230 | Upvalue += 1 231 | print(Upvalue) 232 | end 233 | 234 | DummyFunction() -- Output: 91 235 | debug.setupvalue(DummyFunction, 1, 99) 236 | DummyFunction() -- Output: 100 237 | ``` 238 | 239 | --- 240 | 241 | ## debug.getstack 242 | 243 | Returns all used values in the provided stack level. 244 | 245 | ```luau 246 | function debug.getstack(level: number, index: number?): any | { any } 247 | ``` 248 | 249 | ### Parameters 250 | 251 | - `level` - The call stack. 252 | - `index?` - The position of the values inside the stack frame. 253 | 254 | ### Examples 255 | 256 | ```luau 257 | -- level 1 258 | local Count = 0 259 | local function RecursiveFunction() -- Entering a level deeper, meaning we can call using level 2 in this function 260 | Count += 1 261 | if Count > 6 then return end -- We'll stop at 6 to not retrieve useless information for our example 262 | local a = 29 263 | local b = true 264 | local c = "Example" 265 | a += 1 266 | b = false 267 | c..="s" 268 | print(debug.getstack(1, Count)) 269 | RecursiveFunction() 270 | end 271 | 272 | RecursiveFunction() 273 | -- Output: 274 | -- 30 275 | -- false 276 | -- Examples 277 | -- function: 0x... <-- print function 278 | -- function: 0x... <-- getstack function 279 | -- 1 <-- argument provided to getstack function 280 | ``` 281 | 282 | ```luau 283 | local function DummyFunction() return "Hello" end 284 | local Var = 5 285 | Var += 1 286 | 287 | (function() 288 | print(debug.getstack(2)[1]()) -- Output: Hello 289 | print(debug.getstack(2)[2]) -- Output: 6 290 | end)() 291 | ``` 292 | 293 | --- 294 | 295 | ## debug.setstack 296 | 297 | Sets a value in the stack at the specified index. 298 | 299 | ```luau 300 | function debug.setstack(level: number, index: number, value: any): () 301 | ``` 302 | 303 | ### Parameters 304 | 305 | - `level` - The call stack. 306 | - `index` - The position of the values inside the stack frame. 307 | - `value` - The new value to set at the specified position. 308 | 309 | ### Examples 310 | 311 | ```luau 312 | error(debug.setstack(1, 1, function() -- Replace error with our function 313 | return function() 314 | print("Replaced") 315 | end 316 | end))() -- Output: Replaced 317 | ``` 318 | 319 | ```luau 320 | local OuterValue = 10 321 | 322 | local function InnerFunction() 323 | OuterValue += 9 324 | debug.setstack(2, 1, 100) 325 | end 326 | InnerFunction() 327 | 328 | print(OuterValue) -- Output: 100 329 | ``` 330 | 331 | --- 332 | 333 | ## debug.getprotos 334 | 335 | Returns all the functions defined in the provided function. 336 | 337 | ```luau 338 | function debug.getprotos(func: (...any) -> (...any) | number): { (...any) -> (...any) } 339 | ``` 340 | 341 | ### Parameter 342 | 343 | - `func` - The function to obtain the protos from. 344 | 345 | ### Example 346 | 347 | ```luau 348 | local function DummyFunction0() 349 | local function DummyFunction1() end 350 | local function DummyFunction2() end 351 | end 352 | 353 | for IndexProto, ValueProto in pairs(debug.getprotos(DummyFunction0)) do 354 | print(IndexProto, debug.info(ValueProto, "n")) 355 | end 356 | 357 | -- Output: 358 | -- DummyFunction1 359 | -- DummyFunction2 360 | ``` 361 | 362 | --- 363 | 364 | ## debug.getproto 365 | 366 | Returns the proto at the specified position. If third argument is true, instead returns a table which contains the active functions of the proto. 367 | 368 | ```luau 369 | function debug.getproto(func: (...any) -> (...any) | number, index: number, activated: boolean?): (...any) -> (...any) | { (...any) -> (...any) } 370 | ``` 371 | 372 | ### Parameters 373 | 374 | - `func` - The function to obtain the proto from. 375 | - `index` - The position of the proto. 376 | - `activated` - Whether to search the GC for the active function of the proto. 377 | 378 | ### Examples 379 | 380 | ```luau 381 | local function DummyFunction() 382 | local function DummyProto1() 383 | print("Hello") 384 | end 385 | local function DummyProto2() 386 | print("Hello2") 387 | end 388 | end 389 | 390 | debug.getproto(DummyFunction, 1)() -- Output: Hello 391 | debug.getproto(DummyFunction, 2)() -- Output: Hello2 392 | ``` 393 | 394 | ```luau 395 | local function DummyFunction() 396 | local function DummyProto() 397 | return "hi" 398 | end 399 | return DummyProto 400 | end 401 | 402 | local RealProto = DummyFunction() 403 | local RetrievedProto = debug.getproto(DummyFunction, 1, true)[1] 404 | 405 | print(RealProto == RetrievedProto) -- Output: true 406 | print(RetrievedProto()) -- Output: hi 407 | ``` 408 | -------------------------------------------------------------------------------- /Libraries/Drawing.md: -------------------------------------------------------------------------------- 1 | # Drawing 2 | 3 | The **Drawing** library provides an interface for rendering shapes and text onto the game window. 4 | 5 | --- 6 | 7 | ## Drawing.new 8 | 9 | Creates a new drawing object of the specified type. The possible types are: Line, Text, Image, Circle, Square, Quad, and Triangle. 10 | 11 | ```luau 12 | function Drawing.new(type: string): Drawing 13 | ``` 14 | 15 | ## Parameters 16 | 17 | - `type` - The type of drawing object to create. 18 | 19 | ## Example 20 | 21 | ```luau 22 | local Camera = game.Workspace.CurrentCamera 23 | local Viewport = Camera.ViewportSize 24 | local Position = Vector2.new(Viewport.X / 2, Viewport.Y / 2) 25 | 26 | local circle = Drawing.new("Circle") 27 | circle.Radius = 50 28 | circle.Color = Color3.fromRGB(255, 0, 0) 29 | circle.Filled = true 30 | circle.NumSides = 32 31 | circle.Position = Position 32 | circle.Transparency = 0.7 33 | circle.Visible = true 34 | 35 | task.wait(0.6) 36 | circle:Destroy() 37 | ``` 38 | 39 | --- 40 | 41 | ## Drawing 42 | 43 | The class which all drawing objects will inherit. 44 | 45 | | Property | Type | Description | 46 | | ----------------| -------------------------------------------------------------------------------------------| --------------------------------------------------------------------| 47 | | Visible | boolean | Whether the drawing is visible. Defaults to `false`. | 48 | | ZIndex | number | Determines the order in which a Drawing renders relative to others. | 49 | | Transparency | number | The opacity of the drawing (1 - opaque, 0 - transparent). | 50 | | Color | Color3 | The color of the drawing. | 51 | | __OBJECT_EXISTS | boolean | Whether the object exists. | 52 | | Destroy(): () | function | Destroys the drawing. | 53 | 54 | ### Line 55 | 56 | Renders a line starting at `From` and ending at `To`. 57 | 58 | | Property | Type | Description | 59 | | -------- | ---- | ----------- | 60 | | `From` | Vector2 | The starting point of the line. | 61 | | `To` | Vector2 | The ending point of the line. | 62 | | `Thickness` | number | The thickness of the line. | 63 | 64 | ### Text 65 | 66 | Renders text at `Position`. 67 | 68 | | Property | Type | Description | 69 | | -------- | ---- | ----------- | 70 | | `Text` | string | The text to render. | 71 | | `TextBounds` | 🔒 Vector2 | The size of the text. Cannot be set. | 72 | | `Font` | Drawing.Font | The font to use. | 73 | | `Size` | number | The size of the text. | 74 | | `Position` | Vector2 | The position of the text. | 75 | | `Center` | boolean | Whether the text should be centered horizontally. | 76 | | `Outline` | boolean | Whether the text should be outlined. | 77 | | `OutlineColor` | Color3 | The color of the outline. | 78 | 79 | ### Image 80 | 81 | Draws the image data to the screen. `Data` *must* be the raw image data. 82 | 83 | | Property | Type | Description | 84 | | -------- | ---- | ----------- | 85 | | `Data` | string | The raw image data of the file. You can use `readfile` or another method to read the raw bytecode of the image. | 86 | | `Size` | Vector2 | The size of the image. | 87 | | `Position` | Vector2 | The position of the image. | 88 | | `Rounding` | number | The rounding of the image. | 89 | 90 | ### Circle 91 | 92 | Draws a circle that is centered at `Position`. 93 | 94 | | Property | Type | Description | 95 | | -------- | ---- | ----------- | 96 | | `NumSides` | number | The sides number of the circle. | 97 | | `Radius` | number | The radius of the circle. | 98 | | `Position` | Vector2 | The center position of the circle. | 99 | | `Thickness` | number | If `Filled` is false, specifies the thickness of the outline. | 100 | | `Filled` | boolean | Whether the circle should be filled. | 101 | 102 | ### Square 103 | 104 | Draws a rectangle starting at `Position` and ending at `Position` + `Size`. 105 | 106 | | Property | Type | Description | 107 | | -------- | ---- | ----------- | 108 | | `Size` | Vector2 | The size of the square. | 109 | | `Position` | Vector2 | The top-left corner position of the square. | 110 | | `Thickness` | number | If `Filled` is false, specifies the thickness of the outline. | 111 | | `Filled` | boolean | Whether the square should be filled. | 112 | 113 | ### Quad 114 | 115 | Draws a four-sided figure connecting to each of the four points. 116 | 117 | | Property | Type | Description | 118 | | -------- | ---- | ----------- | 119 | | `PointA` | Vector2 | The first point. | 120 | | `PointB` | Vector2 | The second point. | 121 | | `PointC` | Vector2 | The third point. | 122 | | `PointD` | Vector2 | The fourth point. | 123 | | `Thickness` | number | If `Filled` is false, specifies the thickness of the outline. | 124 | | `Filled` | boolean | Whether the quad should be filled. | 125 | 126 | ### Triangle 127 | 128 | Draws a triangle connecting to each of the three points. 129 | 130 | | Property | Type | Description | 131 | | -------- | ---- | ----------- | 132 | | `PointA` | Vector2 | The first point. | 133 | | `PointB` | Vector2 | The second point. | 134 | | `PointC` | Vector2 | The third point. | 135 | | `Thickness` | number | If `Filled` is false, specifies the thickness of the outline. | 136 | | `Filled` | boolean | Whether the triangle should be filled. | 137 | 138 | --- 139 | 140 | ### Example - `Image` 141 | 142 | Upong replacing `your_image.png` and executing the example below, you should be able to see your image in the middle of the screen. 143 | 144 | ```luau 145 | local Camera = game.Workspace.CurrentCamera 146 | local Viewport = Camera.ViewportSize 147 | local Position = Vector2.new(Viewport.X / 2, Viewport.Y / 2) 148 | local image = Drawing.new("Image") 149 | image.Data = readfile("your_image.png") 150 | image.Size = Vector2.new(455, 155) 151 | image.Visible = true 152 | image.Position = Position 153 | 154 | task.wait(2) 155 | image:Destroy() 156 | ``` 157 | 158 | --- 159 | 160 | ### Example - `__OBJECT_EXISTS` 161 | 162 | ```luau 163 | local Camera = game.Workspace.CurrentCamera 164 | local Viewport = Camera.ViewportSize 165 | local Position = Vector2.new(Viewport.X / 2, Viewport.Y / 2) 166 | 167 | local circle = Drawing.new("Circle") 168 | circle.Radius = 50 169 | circle.Color = Color3.fromRGB(255, 0, 0) 170 | circle.Filled = true 171 | circle.NumSides = 150 172 | circle.Position = Position 173 | circle.Transparency = 1 174 | circle.Visible = true 175 | 176 | print(circle.__OBJECT_EXISTS) -- Output: true 177 | circle:Destroy() 178 | print(circle.__OBJECT_EXISTS) -- Output: false 179 | ``` 180 | 181 | --- 182 | 183 | ## cleardrawcache 184 | 185 | Destroys every drawing object in the cache, invalidating references to the drawing objects. 186 | 187 | ```lua 188 | function cleardrawcache(): () 189 | ``` 190 | 191 | ### Example 192 | 193 | ```luau 194 | local Camera = game.Workspace.CurrentCamera 195 | local Viewport = Camera.ViewportSize 196 | local Position = Vector2.new(Viewport.X / 2, Viewport.Y / 2) 197 | 198 | local circle = Drawing.new("Circle") 199 | circle.Radius = 50 200 | circle.Color = Color3.fromRGB(255, 0, 0) 201 | circle.Filled = true 202 | circle.NumSides = 1111 203 | circle.Position = Position 204 | circle.Transparency = 1 205 | circle.Visible = true 206 | 207 | task.defer(cleardrawcache) 208 | print(circle.__OBJECT_EXISTS) -- Outpuut: true 209 | task.wait() 210 | print(circle.__OBJECT_EXISTS) -- Output: false 211 | ``` 212 | 213 | --- 214 | 215 | ## getrenderproperty 216 | 217 | Gets the value of a drawing property, functionally similar to `drawing[property]`. 218 | 219 | ```lua 220 | function getrenderproperty(drawing: Drawing, property: string): any 221 | ``` 222 | 223 | ### Parameters 224 | 225 | - `drawing` - The drawing's property to get. 226 | - `property` - The property. 227 | 228 | ### Example 229 | 230 | ```luau 231 | local circle = Drawing.new("Circle") 232 | circle.Radius = 50 233 | print(getrenderproperty(circle, "Radius")) -- Output: 50 234 | print(getrenderproperty(circle, "Visible")) -- Output: false 235 | ``` 236 | 237 | --- 238 | 239 | ## setrenderproperty 240 | 241 | Sets the value of a drawing property, functionally similar to `drawing[property] = value`. 242 | 243 | ```luau 244 | function setrenderproperty(drawing: Drawing, property: string, value: any): () 245 | ``` 246 | 247 | ### Parameters 248 | 249 | - `drawing` - The drawing's property to set. 250 | - `property` - The property. 251 | - `value` - The value to set the property to. 252 | 253 | ### Example 254 | 255 | ```luau 256 | local circle = Drawing.new("Circle") 257 | setrenderproperty(circle, "Radius", 50) 258 | setrenderproperty(circle, "Visible", true) 259 | print(circle.Radius) -- Output: 50 260 | print(circle.Visible) -- Output: true 261 | ``` 262 | 263 | --- 264 | 265 | ## isrenderobj 266 | 267 | Returns whether `object` is a valid Drawing object. 268 | 269 | ```luau 270 | function isrenderobj(object: any): boolean 271 | ``` 272 | 273 | ### Parameters 274 | 275 | - `object` - The object to determine. 276 | 277 | ### Example 278 | 279 | ```luau 280 | print(isrenderobj(Drawing.new("Square"))) -- Output: true 281 | print(isrenderobj(game)) -- Output: false 282 | ``` 283 | -------------------------------------------------------------------------------- /Libraries/Environment.md: -------------------------------------------------------------------------------- 1 | # Environment 2 | 3 | These functions allow to **modify/access** our executor environment and Roblox environment. 4 | 5 | --- 6 | 7 | ## getgenv 8 | 9 | Returns a table containing all executor functions, serving as the shared environment for all scripts executed by the executor. 10 | 11 | ```luau 12 | function getgenv(): { any } 13 | ``` 14 | 15 | ### Example 16 | 17 | ```luau 18 | getgenv().test = "hello world" 19 | print(test) -- Output: hello world 20 | ``` 21 | 22 | --- 23 | 24 | ## getrenv 25 | 26 | Returns a table containing the Roblox environment. 27 | 28 | > [!NOTE] 29 | > Any changes to this environment shouldn't affect the executor; however it should affect game scripts. 30 | 31 | ```luau 32 | function getrenv(): { any } 33 | ``` 34 | 35 | ### Example 36 | 37 | ```luau 38 | getrenv().game = nil -- game scripts won't be able to access game 39 | getrenv().warn = "Hello" 40 | print(type(warn)) -- Output: string 41 | ``` 42 | 43 | --- 44 | 45 | ## getgc 46 | 47 | Returns a table with all collectible values that aren't dead (meaning they are referenced by active scripts). 48 | 49 | By default, it excludes tables; you can use `includeTables` to also get tables. 50 | 51 | ```luau 52 | function getgc(include_tables: boolean?): { { any } | (...any) -> (...any) | userdata } 53 | ``` 54 | 55 | ### Parameter 56 | 57 | - `include_tables?` - Whether the output table should also include tables 58 | 59 | ### Examples 60 | 61 | ```luau 62 | local DummyTable = {} 63 | local function DummyFunction() end 64 | task.wait(0.05) -- Step a bit 65 | 66 | for GarbageIndex, GarbageValue in pairs(getgc()) do 67 | if GarbageValue == DummyFunction then 68 | print(`Found function: {DummyFunction}`) 69 | elseif GarbageValue == DummyTable then 70 | print(`Found table?: {DummyTable}`) -- This shouldn't print 71 | end 72 | end 73 | ``` 74 | 75 | ```luau 76 | local DummyTable = {} 77 | local function DummyFunction() end 78 | task.wait(0.05) -- Step a bit 79 | 80 | for GarbageIndex, GarbageValue in pairs(getgc(true)) do 81 | if GarbageValue == DummyFunction then 82 | print(`Found function: {DummyFunction}`) -- Both should print 83 | elseif GarbageValue == DummyTable then 84 | print(`Found table: {DummyTable}`) -- Both should print 85 | end 86 | end 87 | ``` 88 | 89 | --- 90 | 91 | ## filtergc 92 | 93 | Similar to `getgc`, will return Lua values that are being referenced and match the specified criteria. 94 | 95 | ```luau 96 | function filtergc(filter_type: "function" | "table", filter_options: FunctionFilterOptions | TableFilterOptions, return_one: boolean?): (...any) -> (...any) | { [any]: any } | { (...any) -> (...any) | { [any]: any } } 97 | ``` 98 | 99 | ### Table filter options: 100 | 101 | | Key | Description | Default | 102 | | -------------- | ------------------------------------------------------------------------------------------------- | ------- | 103 | | `Keys` | If not empty, also include tables with keys corresponding to all values in this table. | `nil` | 104 | | `Values` | If not empty, also include tables with values corresponding to all values in this table. | `nil` | 105 | | `KeyValuePairs`| If not empty, also include tables with keys/value pairs corresponding to all values in this table. | `nil` | 106 | | `Metatable` | If not empty, also include tables with the metatable passed. | `nil` | 107 | 108 | ### Function filter options: 109 | 110 | | Key | Description | Default | 111 | | --------------- | --------------------------------------------------------------------------------------- | ------- | 112 | | `Name` | If not empty, also include functions with this name. | `nil` | 113 | | `IgnoreExecutor`| If true, also exclude functions made in the executor. | `true` | 114 | | `Hash` | If not empty, also include functions with the specified hash of their bytecode. | `nil` | 115 | | `Constants` | If not empty, also include functions with constants that match all values in this table. | `nil` | 116 | | `Upvalues` | If not empty, also include functions with upvalues that match all values in this table. | `nil` | 117 | 118 | ### Parameters 119 | 120 | - `filter_type` - Specifies the type of Lua value to search for. 121 | - `filter_options` - Criteria used to filter the search results based on the specified type. 122 | - `return_one?` - A boolean that returns only the first match when true; otherwise, all matches are returned. 123 | 124 | > [!NOTE] 125 | > Executing these examples multiple times in a short period of time may result in false negatives. 126 | 127 | ### Examples - Function 128 | 129 | 130 | Usage of `Name` and `return_one?` set to `false` (default option): 131 | ```luau 132 | local function DummyFunction() 133 | end 134 | 135 | local Retrieved = filtergc("function", { 136 | Name = "DummyFunction", 137 | IgnoreExecutor = false 138 | }) 139 | 140 | print(typeof(Retrieved)) -- Output: table 141 | print(Retrieved[1] == DummyFunction) -- Output: true 142 | ``` 143 | 144 | Usage of `Name` and `return_one?` set to `true`: 145 | ```luau 146 | local function DummyFunction() 147 | end 148 | 149 | local Retrieved = filtergc("function", { 150 | Name = "DummyFunction", 151 | IgnoreExecutor = false 152 | }, true) 153 | 154 | print(typeof(Retrieved)) -- Output: function 155 | print(Retrieved == DummyFunction) -- Output: true 156 | ``` 157 | 158 | ### Usage of `options` parameter 159 | 160 | Usage of `Hash`: 161 | ```luau 162 | local function DummyFunction() 163 | return "Hello" 164 | end 165 | 166 | local DummyFunctionHash = getfunctionhash(DummyFunction) 167 | 168 | local Retrieved = filtergc("function", { 169 | Hash = DummyFunctionHash, -- A C Closure will automatically fail this filter because it's impossible to rebuild the bytecode of a C Closure 170 | IgnoreExecutor = false 171 | }, true) 172 | 173 | print(getfunctionhash(Retrieved) == DummyFunctionHash) -- Output: true 174 | print(Retrieved == DummyFunction) -- Output: true 175 | ``` 176 | 177 | Usage of `Constants` and `Upvalues`: 178 | ```luau 179 | local Upvalue = 5 180 | 181 | local function DummyFunction() 182 | Upvalue += 1 183 | print(game.Players.LocalPlayer) 184 | end 185 | 186 | local Retrieved = filtergc("function", { 187 | Constants = { "print", "game", "Players", "LocalPlayer", 1 }, -- A C Closure will automatically fail this filter because a C Closure does not have Constants 188 | Upvalues = { 5 }, 189 | IgnoreExecutor = false 190 | }, true) 191 | 192 | print(Retrieved == DummyFunction) -- Output: true 193 | ``` 194 | 195 | --- 196 | 197 | ### Examples - Table 198 | 199 | Usage of `Keys` and `Values`: 200 | ```lua 201 | local DummyTable = { ["DummyKey"] = "" } 202 | 203 | local Retrieved = filtergc("table", { 204 | Keys = { "DummyKey" }, 205 | }, true) 206 | 207 | print(Retrieved == DummyTable) -- Output: true 208 | ``` 209 | 210 | Usage of `KeyValuePairs`: 211 | ```luau 212 | local DummyTable = { ["DummyKey"] = "DummyValue" } 213 | 214 | local Retrieved = filtergc("table", { 215 | KeyValuePairs = { ["DummyKey"] = "DummyValue" }, 216 | }, true) 217 | 218 | print(Retrieved == DummyTable) -- Output: true 219 | ``` 220 | 221 | Usage of `Metatable`: 222 | ```luau 223 | local DummyTable = setmetatable( {}, { __index = getgenv() } ) 224 | 225 | local Retrieved = filtergc("table", { 226 | Metatable = getmetatable(DummyTable) 227 | }, true) 228 | 229 | print(Retrieved == DummyTable) -- Output: true 230 | ``` 231 | -------------------------------------------------------------------------------- /Libraries/Filesystem.md: -------------------------------------------------------------------------------- 1 | # Filesystem 2 | 3 | Functions that provide read and write access to a files in an executor's workspace. 4 | 5 | > [!WARNING] 6 | > **Filesystem** functions should restrict access to read and write potentially harmful file types like `.exe` or `.bat`. 7 | 8 | --- 9 | 10 | ## writefile 11 | 12 | Writes data to a specified file path. 13 | 14 | ```luau 15 | function writefile(path: string, data: string): () 16 | ``` 17 | 18 | ### Parameters 19 | - `path` - path to the file that will be wrote to. 20 | - `data` - the data to be written into the file. 21 | 22 | ### Example 23 | 24 | ```luau 25 | writefile("file.txt", "Hello world") 26 | print(readfile("file.txt")) -- Output: Hello world 27 | ``` 28 | 29 | --- 30 | 31 | ## readfile 32 | 33 | Retrieves the content of the file at the specified path. 34 | 35 | ```luau 36 | function readfile(path: string): string 37 | ``` 38 | 39 | ### Parameter 40 | - `path` - path to the file that will be read. 41 | 42 | ### Example 43 | 44 | ```luau 45 | writefile("file0.txt", "Hello") 46 | print(readfile("file0.txt")) -- Output: Hello 47 | ``` 48 | 49 | --- 50 | 51 | ## listfiles 52 | 53 | Provides a list of files and folders within a specified directory. 54 | 55 | ```luau 56 | function listfiles(path: string): { string } 57 | ``` 58 | 59 | ### Parameter 60 | - `path` - path to the directory. 61 | 62 | ### Example 63 | 64 | ```luau 65 | writefile("file1.txt", "") 66 | writefile("file2.lua", "") 67 | task.wait() 68 | for _, File in listfiles("") do 69 | if File == "file1.txt" then 70 | print(`Found: {File}`) -- Output: Found: file1.txt 71 | end 72 | if File == "file2.lua" then 73 | print(`Found: {File}`) -- Output: Found: file2.lua 74 | end 75 | end 76 | ``` 77 | 78 | --- 79 | 80 | ## isfile 81 | 82 | Determines if the specified path is a file. 83 | 84 | ```luau 85 | function isfile(path: string): boolean 86 | ``` 87 | 88 | ### Parameter 89 | - `path` - The path to the file. 90 | 91 | ### Example 92 | 93 | ```luau 94 | print(isfile("nonexistent.txt")) -- Output: false 95 | writefile("file3.txt", "") 96 | print(isfile("file3.txt")) -- Output: true 97 | ``` 98 | 99 | --- 100 | 101 | ## appendfile 102 | 103 | Appends data to the end of the file at the specified path, creating the file if it doesn't already exist. 104 | 105 | ```luau 106 | function appendfile(path: string, contents: string): () 107 | ``` 108 | 109 | ### Parameters 110 | - `path` - Path to the file. 111 | - `contents` - The content to append. 112 | 113 | ### Example 114 | 115 | ```luau 116 | writefile("file4.txt", "print(") 117 | appendfile("file4.txt", "'Hello')") 118 | print(readfile("file4.txt")) -- Output: print('Hello') 119 | ``` 120 | 121 | --- 122 | 123 | ## delfile 124 | 125 | Deletes the file at the specified path. 126 | 127 | ```luau 128 | function delfile(path: string): () 129 | ``` 130 | 131 | ### Parameter 132 | 133 | - `path` - Path to the file. 134 | 135 | ### Example 136 | 137 | ```luau 138 | writefile("file5.txt", "Hello") 139 | print(isfile("file5.txt")) -- Output: true 140 | delfile("file5.txt") 141 | print(isfile("file5.txt")) -- Output: false 142 | ``` 143 | 144 | --- 145 | 146 | ## loadfile 147 | 148 | Generates a chunk from the file at the given path, using the global environment. Returns the chunk or nil with an error message. 149 | 150 | ```luau 151 | function loadfile(path: string): () 152 | ``` 153 | 154 | ### Parameter 155 | 156 | - `path` - Path to the file. 157 | 158 | ### Examples 159 | 160 | ```luau 161 | writefile("file6.lua", "return 10 + ...") 162 | local Func, Err = loadfile("file5.lua") 163 | print(Func(1), Err) -- Output: 11, nil 164 | ``` 165 | 166 | ```luau 167 | writefile("file6.lua", "retrn 10 ...") 168 | local Func, Err = loadfile("file5.lua") 169 | 170 | if Func == nil and string.find(Err, "expected assignment or a function call") then 171 | print("Caught the error") -- Output: Caught the error 172 | end 173 | ``` 174 | 175 | --- 176 | 177 | ## makefolder 178 | 179 | Creates a folder at the specified path if it doesn't already exist. 180 | 181 | ```luau 182 | function makefolder(path: string): () 183 | ``` 184 | 185 | ### Parameter 186 | 187 | - `path` - The location where you want to create the folder. 188 | 189 | ### Example 190 | 191 | ```luau 192 | makefolder("folder") 193 | print(isfolder("folder")) -- Output: true 194 | ``` 195 | 196 | --- 197 | 198 | ## isfolder 199 | 200 | Determines if the specified path is a folder. 201 | 202 | ```luau 203 | function isfolder(path: string): boolean 204 | ``` 205 | 206 | ### Parameter 207 | 208 | - `path` - The path to check. 209 | 210 | ### Example 211 | 212 | ```luau 213 | writefile("file7.txt", "") 214 | makefolder("folder2") 215 | print(isfolder("file7.txt")) -- Output: false 216 | print(isfolder("folder2")) -- Output: true 217 | ``` 218 | 219 | --- 220 | 221 | ## delfolder 222 | 223 | Deletes the folder at the specified path. 224 | 225 | ```luau 226 | function delfolder(path: string): () 227 | ``` 228 | 229 | ### Parameter 230 | 231 | - `path` - Path to the folder you will delete. 232 | 233 | ### Example 234 | 235 | ```luau 236 | makefolder("folder3") 237 | print(isfolder("folder3")) -- Output: true 238 | delfolder("folder3") 239 | print(isfolder("folder3")) -- Output: false 240 | ``` 241 | 242 | --- 243 | 244 | ## getcustomasset 245 | 246 | Returns a content URL `(e.g., rbxasset://)` that can be used with UI elements, sounds, meshes, and more. Internally, files are copied to the game's content directory. 247 | 248 | ```luau 249 | function getcustomasset(path: string): string 250 | ``` 251 | 252 | ### Parameter 253 | 254 | - `path` - The path to the file. 255 | 256 | ### Example 257 | 258 | ```luau 259 | -- Will load and play an mp3 sound in-game. 260 | local Encoded = game:HttpGet("https://gitlab.com/sens3/nebunu/-/raw/main/encodedBytecode.txt?ref_type=heads") 261 | writefile("ExampleSound.mp3", crypt.base64decode(Encoded)) -- Write bytes to file 262 | local Retrieved = getcustomasset("ExampleSound.mp3") 263 | local Sound = Instance.new("Sound") 264 | Sound.Parent = workspace 265 | Sound.SoundId = Retrieved 266 | Sound.Volume = 0.35 267 | Sound:Play() 268 | ``` 269 | -------------------------------------------------------------------------------- /Libraries/Instances.md: -------------------------------------------------------------------------------- 1 | # Instances 2 | 3 | The **Instance** library allows interaction with game objects. 4 | 5 | --- 6 | 7 | ## getinstances 8 | 9 | > [!NOTE] 10 | > **getinstances** should be able to return instances outside of `game`. 11 | 12 | Returns a list of all instances referenced by the client. 13 | 14 | ```luau 15 | function getinstances(): { Instance } 16 | ``` 17 | 18 | ### Example 19 | 20 | ```luau 21 | local DummyPart = Instance.new("Part") 22 | 23 | for IndexInstance, ValueInstance in pairs(getnilinstances()) do 24 | if ValueInstance == DummyPart then 25 | print(`Found the wanted nil instance: {DummyPart}`) 26 | end 27 | end 28 | ``` 29 | 30 | --- 31 | 32 | ## getnilinstances 33 | 34 | Returns a list of instances that have their parent property set to `nil`. 35 | 36 | ```luau 37 | function getnilinstances(): { Instance } 38 | ``` 39 | 40 | ### Example 41 | 42 | ```luau 43 | local DummyPart = Instance.new("Part") 44 | DummyPart.Parent = nil 45 | 46 | for IndexNil, ValueNil in pairs(getnilinstances()) do 47 | if ValueNil == DummyPart then 48 | print(`Found the wanted nil instance: {DummyPart}`) 49 | end 50 | end 51 | ``` 52 | 53 | --- 54 | 55 | ## cloneref 56 | 57 | Returns a copy of the Instance where the copy should not be equal to the original Instance it was cloned from. 58 | 59 | ```luau 60 | function cloneref(object: T & Instance): T 61 | ``` 62 | 63 | ### Parameter 64 | 65 | - `object` - The Instance to clone. 66 | 67 | ### Example 68 | 69 | ```luau 70 | local ClonedPlayer = cloneref(game:GetService("Players").LocalPlayer) 71 | local Player = game:GetService("Players").LocalPlayer 72 | print(Player == ClonedPlayer) -- Output: false 73 | ``` 74 | 75 | --- 76 | 77 | ## compareinstances 78 | 79 | Checks if two instances are equal, used for clonerefed instances as normal equality check fails on them. 80 | 81 | ```luau 82 | function compareinstances(object1: Instance, object2: Instance): boolean 83 | ``` 84 | 85 | ### Parameter 86 | 87 | - `object1` - The instance to check. 88 | - `object2` - The instance to check the first instance with. 89 | 90 | ### Example 91 | 92 | ```luau 93 | print(compareinstances(game, game)) -- Output: true 94 | print(compareinstances(game, workspace)) -- Output: false 95 | print(compareinstances(game, cloneref(game))) -- Output: true 96 | print(game == cloneref(game)) -- Output: false 97 | ``` 98 | 99 | --- 100 | 101 | ## gethui 102 | 103 | > [!NOTE] 104 | > This is an implementation detail; as a regular scripter, you may ignore this! 105 | > The container in which the elements sit in, should not be findable directly. For example, a descendant for loop through CoreGui shouldn't find the container. Although if found directly, the container's parent should be clonereffed. 106 | > 107 | > If you're going for a different approach from the one above, make sure the container is able to be found in the registry. 108 | 109 | Returns a hidden UI container that minimalizes most detection methods. 110 | 111 | ```luau 112 | function gethui(): Instance 113 | ``` 114 | 115 | ### Example 116 | 117 | ```luau 118 | local UI = Instance.new("ScreenGui") 119 | UI.Parent = gethui() 120 | print(gethui().ScreenGui) -- Output: "ScreenGui" 121 | ``` 122 | 123 | --- 124 | 125 | ## getcallbackvalue 126 | 127 | Returns the function assigned to an object's callback property, which is otherwise inaccessible through standard indexing. 128 | 129 | ```luau 130 | function getcallbackvalue(object: Instance, property: string): (...any) -> (...any) 131 | ``` 132 | 133 | ### Parameters 134 | 135 | - `object` - The object to get the callback property from. 136 | - `property` - The name of the callback property. 137 | 138 | ### Example 139 | 140 | ```luau 141 | local DummyBindableFunction = Instance.new("BindableFunction") 142 | local DummyRemoteFunction = Instance.new("RemoteFunction") 143 | 144 | DummyBindableFunction.OnInvoke = function() 145 | print("Callback") 146 | end 147 | 148 | getcallbackvalue(DummyBindableFunction, "OnInvoke")() -- Output: Callback 149 | getcallbackvalue(DummyRemoteFunction, "OnClientInvoke") -- Throws an error 150 | ``` 151 | 152 | --- 153 | 154 | ## fireclickdetector 155 | 156 | > [!NOTE] 157 | > It's not recommended to implement this function in luau. Doing so will expose you to easy detections. 158 | 159 | Triggers a specified event on a `ClickDetector`. The event parameter defaults to **MouseClick** if not defined. Not providing the distance will default to infinite. 160 | 161 | ```luau 162 | function fireclickdetector(object: ClickDetector, distance: number?, event: string?): () 163 | ``` 164 | 165 | Selectable Events: 'MouseClick', 'RightMouseClick', 'MouseHoverEnter', 'MouseHoverLeave'. 166 | 167 | ### Parameters 168 | 169 | - `object` - The ClickDetector to trigger. 170 | - `distance` - Distance to trigger the ClickDetector from. 171 | - `event` - The chosen event to trigger the detector with. 172 | 173 | ### Example 174 | 175 | ```luau 176 | local ClickDetector = Instance.new("ClickDetector") 177 | 178 | ClickDetector.MouseClick:Connect(function() 179 | print("Fired") 180 | end) 181 | 182 | fireclickdetector(ClickDetector, 32) -- This will not output 183 | ``` 184 | 185 | ```luau 186 | local ClickDetector = Instance.new("ClickDetector") 187 | 188 | ClickDetector.MouseClick:Connect(function(player) 189 | print(`{player.Name} Fired M1`) 190 | end) 191 | 192 | ClickDetector.RightMouseClick:Connect(function(player) 193 | print(`{player.Name} Fired M2`) 194 | end) 195 | 196 | ClickDetector.MouseHoverEnter:Connect(function(player) 197 | print(`{player.Name} Fired HoverEnter`) 198 | end) 199 | 200 | ClickDetector.MouseHoverLeave:Connect(function(player) 201 | print(`{player} Fired HoverLeave`) 202 | end) 203 | 204 | fireclickdetector(ClickDetector, 0, "MouseClick") -- Output: Player Fired M1 205 | fireclickdetector(ClickDetector, 0, "RightMouseClick") -- Output: Player Fired M2 206 | fireclickdetector(ClickDetector, 0, "MouseHoverEnter") -- Output: Player Fired HoverEnter 207 | fireclickdetector(ClickDetector, 0, "MouseHoverLeave") -- Output: Player Fired HoverLeave 208 | ``` 209 | 210 | --- 211 | 212 | ## fireproximityprompt 213 | 214 | > [!NOTE] 215 | > It's not recommended to implement this function in luau. Doing so will expose you to easy detections. 216 | 217 | 218 | Triggers a `ProximityPrompt` instantly, regardless of distance or duration. 219 | 220 | ```luau 221 | function fireproximityprompt(object: ProximityPrompt): () 222 | ``` 223 | 224 | ### Parameter 225 | 226 | - `object` - The ProximityPrompt to fire. 227 | 228 | ### Example 229 | 230 | ```luau 231 | local DummyPart = Instance.new("Part", workspace) 232 | local DummyProximityPrompt = Instance.new("ProximityPrompt") 233 | DummyProximityPrompt.Parent = DummyPart 234 | 235 | DummyProximityPrompt.Triggered:Connect(function() 236 | print("Triggered") 237 | end) 238 | 239 | fireproximityprompt(DummyProximityPrompt) -- Output: Triggered 240 | ``` 241 | 242 | --- 243 | 244 | ## firetouchinterest 245 | 246 | > [!NOTE] 247 | > This is an implementation detail; as a regular scripter, you may ignore this! 248 | > 249 | > It's not recommended to implement this function in luau. Doing so will expose you to easy detections. Additionally, when firing the touch interests, the function should yield, in order to allow the next one to fire with no problems. 250 | > 251 | > Both numbers and booleans should be supported for the toggle (1 being true, 0 being false) 252 | 253 | Triggers a `Touched` event on a `BasePart` with the other wanted part. 254 | 255 | ```luau 256 | function firetouchinterest(part: BasePart, part2: BasePart, toggle: boolean | number): () 257 | ``` 258 | 259 | ### Parameters 260 | 261 | - `part` - The part initiating the touch. 262 | - `part2` - The part to be touched. 263 | - `toggle` - Determines the touching event trigger. 264 | - `false` - Starts the **Touched** event. (Touch, internally). 265 | - `true` - Ends the **Touched** event. (Untouch, internally). 266 | 267 | ### Example 268 | 269 | ```luau 270 | local DummyPart = Instance.new("Part") 271 | DummyPart.CFrame = CFrame.new(0, -200, 0) 272 | DummyPart.Anchored = true 273 | DummyPart.Parent = workspace 274 | 275 | DummyPart.Touched:Connect(function(arg1) 276 | print(arg1:IsDescendantOf(game.Players.LocalPlayer.Character)) 277 | end) 278 | 279 | firetouchinterest(game.Players.LocalPlayer.Character.Head, DummyPart, false) 280 | task.wait(0.5) 281 | firetouchinterest(game.Players.LocalPlayer.Character.Head, DummyPart, true) 282 | ``` 283 | -------------------------------------------------------------------------------- /Libraries/Metatables.md: -------------------------------------------------------------------------------- 1 | # Metatables 2 | 3 | The **Metatable** library allows interaction with metatables. 4 | 5 | --- 6 | 7 | ## getrawmetatable 8 | 9 | Returns the metatable of **object**, bypassing the `__metatable` field. 10 | 11 | ```luau 12 | function getrawmetatable(object: any): { [any]: any } 13 | ``` 14 | 15 | ### Parameters 16 | 17 | - `object` - The object to get the metatable of. 18 | 19 | ### Example 20 | 21 | ```luau 22 | print(getrawmetatable(game).__index(game, "workspace")) -- Output: Workspace 23 | ``` 24 | 25 | --- 26 | 27 | ## setrawmetatable 28 | 29 | Sets the metatable of **object** to the metatable provided, bypassing the `__metatable` field. 30 | 31 | ```luau 32 | function setrawmetatable(object: T, metatable: { any }): T 33 | ``` 34 | 35 | ### Parameters 36 | 37 | - `object` - The object's metatable to be set. 38 | - `metatable` - The wanted metatable to set. 39 | 40 | ### Example 41 | 42 | ```luau 43 | local DummyString = "Example" 44 | local StringMetatable = setrawmetatable(DummyString, { __index = getgenv() }) 45 | print(StringMetatable) -- Output: Example 46 | print(Metatable.getgenv) -- Output: function: 0x... 47 | ``` 48 | 49 | --- 50 | 51 | ## setreadonly 52 | 53 | Sets the read-only value to true or false, allowing to write inside read-only tables. 54 | 55 | ```luau 56 | function setreadonly(table: { any }, state: boolean): () 57 | ``` 58 | 59 | ### Parameters 60 | 61 | - `table` - The wanted table to set read-only to. 62 | - `state` - Wanted state to set. 63 | 64 | ### Example 65 | 66 | ```luau 67 | local Metatable = getrawmetatable(game) 68 | Metatable.Example = "Hello" -- Throws an error 69 | setreadonly(Metatable, false) 70 | Metatable.Example = "Hello" 71 | print(Metatable.Example) -- Output: Hello 72 | setreadonly(Metatable, true) 73 | ``` 74 | 75 | --- 76 | 77 | ## isreadonly 78 | 79 | Will return true/false, depending if the table provided is read-only or not. 80 | 81 | ```luau 82 | function isreadonly(table: { any }): boolean 83 | ``` 84 | 85 | ### Parameters 86 | 87 | - `table` - The table to check read-only state on. 88 | 89 | ### Example 90 | 91 | ```luau 92 | print(isreadonly({})) -- Output: false 93 | print(isreadonly(getrawmetatable(game))) -- Output: true 94 | ``` 95 | -------------------------------------------------------------------------------- /Libraries/Miscellaneous.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | 3 | The **miscellaneous** functions are a collection of functions that have no designated category. 4 | 5 | --- 6 | 7 | ## identifyexecutor 8 | 9 | Returns the name and version of the current executor, first string contains the executor's identifier and the second contains the version of the executor. 10 | 11 | ```luau 12 | function identifyexecutor(): (string, string) 13 | ``` 14 | 15 | ### Example 16 | 17 | ```luau 18 | local ExecName, ExecVersion = identifyexecutor() 19 | print(ExecName, ExecVersion) -- Output: "YourName 0.0.1" 20 | ``` 21 | --- 22 | 23 | ## request 24 | 25 | Sends an HTTP request with the given options, yielding until the request is finished, and returns the response. 26 | 27 | ```luau 28 | function request(options: Request): Response 29 | ``` 30 | 31 | ### Request 32 | 33 | | Field | Type | Description | 34 | | ----- | ---- | ----------- | 35 | | `Url` | string | The URL for the request. | 36 | | `Method` | string | The HTTP method to use. Can be `GET`, `POST`, `PATCH`, or `PUT`. | 37 | | `Body` | string? | The body of the request. | 38 | | `Headers` | table? | A table of headers. | 39 | | `Cookies` | table? | A table of cookies. | 40 | 41 | ### Response 42 | 43 | | Field | Type | Description | 44 | | ----- | ---- | ----------- | 45 | | `Body` | string | The body of the response. | 46 | | `StatusCode` | number | The number status code of the response. | 47 | | `StatusMessage` | string | The status message of the response. | 48 | | `Success` | boolean | Whether or not the request was successful. | 49 | | `Headers` | table | A dictionary of headers. | 50 | 51 | ### Headers 52 | 53 | The executor provides the following headers for identification on a web server: 54 | 55 | | Header | Description | 56 | | ------ | ----------- | 57 | | `PREFIX-User-Identifier` | A string unique to each user, and does not change if the script executor is used across computers. | 58 | | `PREFIX-Fingerprint` | The hardware identifier of the user. | 59 | | `User-Agent` | The name and version of the executor. | 60 | 61 | ### Parameters 62 | 63 | - `options` - The options to use. 64 | 65 | ### Examples 66 | ```luau 67 | local Response = request({ 68 | Url = "http://httpbin.org/get", 69 | Method = "GET", 70 | }) 71 | 72 | local RetrievedFingerprint 73 | 74 | local Decoded = game:GetService("HttpService"):JSONDecode(Response.Body) 75 | for i, v in pairs(Decoded["headers"]) do 76 | if i:match("Fingerprint") then RetrievedFingerprint = i break end 77 | end 78 | 79 | print(Response.StatusCode) -- Output: 200 80 | print(Response.Success) -- Output: true 81 | print(RetrievedFingerprint) -- Output: Prefix-Fingerprint ("Prefix" being the exec's name) 82 | ``` 83 | 84 | ```luau 85 | local Response = request({ 86 | Url = "http://httpbin.org/post", 87 | Method = "POST", 88 | Body = "Example" 89 | }) 90 | 91 | print(Response.StatusMessage) -- Output: 200 92 | print(Response.StatusCode) -- Output: true 93 | print(game:GetService("HttpService"):JSONDecode(Response.Body).data) -- Output: Example 94 | ``` 95 | -------------------------------------------------------------------------------- /Libraries/Reflection.md: -------------------------------------------------------------------------------- 1 | # Reflection 2 | 3 | Functions that allow to **modify/access** hidden/non-scriptable properties of Instances. 4 | 5 | --- 6 | 7 | ## gethiddenproperty 8 | 9 | > [!WARNING] 10 | > Many executors may implement this function by using `setscriptable`, which is discouraged due to detection vectors and/or limitations coming with `setscriptable` itself. 11 | 12 | Returns the hidden, non-scriptable properties value no matter its type, such as `BinaryString`, `SharedString` and `SystemAddress`. A boolean will also be returned, indicating if the property is hidden or not. 13 | 14 | 15 | ```luau 16 | function gethiddenproperty(instance: Instance, property_name: string): (any, boolean) 17 | ``` 18 | 19 | ### Parameters 20 | 21 | - `instance` - The instance that contains the property. 22 | - `property_name` - The name of the property to be read. 23 | 24 | ### Example 25 | 26 | ```luau 27 | local part = Instance.new("Part") 28 | print(gethiddenproperty(part, "Name")) -- Output: "Part", false 29 | print(gethiddenproperty(part, "DataCost")) -- Output: 20, true 30 | ``` 31 | 32 | --- 33 | 34 | ## sethiddenproperty 35 | 36 | > [!WARNING] 37 | > Many executors may implement this function by using `setscriptable`, which is discouraged due to detection vectors and/or limitations coming with `setscriptable` itself. 38 | 39 | 40 | Sets the hidden, non-scriptable property's value no matter its type, such as `BinaryString`, `SharedString` and `SystemAddress`. A boolean will also be returned, indicating if the property is hidden or not. 41 | 42 | Avoids detections and errors that can happen by just using `setscriptable` to set the property 43 | 44 | ```luau 45 | function sethiddenproperty(instance: Instance, property_name: string, property_value: any): boolean 46 | ``` 47 | 48 | ### Parameters 49 | 50 | - `instance` - The instance that contains the property. 51 | - `property_name` - The name of the property to be assigned. 52 | - `property_value` - The value to which the property should be set. 53 | 54 | ### Example 55 | 56 | ```luau 57 | local part = Instance.new("Part") 58 | print(gethiddenproperty(part, "DataCost")) -- Output: 20, true 59 | sethiddenproperty(part, "DataCost", 100) 60 | print(gethiddenproperty(part, "DataCost")) -- Output: 100, true 61 | ``` 62 | 63 | --- 64 | 65 | ## setscriptable 66 | 67 | Sets a hidden property scriptable, which means you will be able to index the hidden properties as if they weren't hidden. 68 | 69 | > [!WARNING] 70 | > This function exposes detection vectors, as game scripts can check whether they can also index those properties. 71 | 72 | > [!NOTE] 73 | > This function is limited, meaning you won't be able to use it on all the hidden properties; use `gethiddenproperty` for those instead. 74 | 75 | ```luau 76 | function setscriptable(object: Instance, property: string, state: boolean): boolean | nil 77 | ``` 78 | 79 | ### Parameters 80 | 81 | - `object` - The instance's property to set scriptable. 82 | - `property` - The wanted property to set scriptable. 83 | - `state` - Whether to turn it scriptable (true) or non-scriptable (false). 84 | 85 | ### Example 86 | 87 | ```luau 88 | local a = Instance.new("Part") 89 | setscriptable(a, "BottomParamA", true) 90 | print(a.BottomParamA) -- Output: -0.5 91 | setscriptable(a, "BottomParamA", false) 92 | print(a.BottomParamA) -- Throws an error 93 | ``` 94 | 95 | --- 96 | 97 | ## checkcaller 98 | 99 | Determines whether the function was called from the executor's thread or not. 100 | 101 | ```luau 102 | function checkcaller(): boolean 103 | ``` 104 | 105 | ### Example 106 | 107 | ```luau 108 | local FromCaller 109 | local _; _ = hookmetamethod(game, "__namecall", function(...) 110 | if FromCaller ~= true then 111 | FromCaller = checkcaller() 112 | end 113 | return _(...) 114 | end) 115 | 116 | task.wait(0.09) -- Step a bit 117 | hookmetamethod(game, "__namecall", _) 118 | 119 | print(FromCaller) -- Output: false 120 | print(checkcaller()) -- Output: true 121 | ``` 122 | 123 | --- 124 | 125 | ## setthreadidentity 126 | 127 | Sets the current thread's identity to the wanted value 128 | 129 | ```luau 130 | function setthreadidentity(id: number): () 131 | ``` 132 | 133 | ### Parameters 134 | 135 | - `id` - The wanted identity to change to 136 | 137 | ### Example 138 | 139 | ```luau 140 | setthreadidentity(2) 141 | print(game.CoreGui) -- Throws an error 142 | setthreadidentity(8) 143 | print(pcall(Instance.new, "Player")) -- Output: true Player 144 | ``` 145 | 146 | --- 147 | 148 | ## getthreadidentity 149 | 150 | Gets the current thread's identity 151 | 152 | ```luau 153 | function getthreadidentity(): number 154 | ``` 155 | 156 | ### Example 157 | 158 | ```luau 159 | task.defer(function() setthreadidentity(2); print(getthreadidentity()) end) 160 | setthreadidentity(3) 161 | print(getthreadidentity()) 162 | 163 | -- Output: 164 | -- 3 165 | -- 2 166 | ``` 167 | -------------------------------------------------------------------------------- /Libraries/Scripts.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | The **Script** library provides functions that access to script environments and internal state. 4 | 5 | --- 6 | 7 | ## getscriptbytecode 8 | 9 | > [!NOTE] 10 | > This function should return `nil` if the script has no bytecode. 11 | > We encourage this behavior, as it's easier for people to check for `nil`, rather than each executor having its own output. 12 | 13 | ```luau 14 | function getscriptbytecode(script: Script | LocalScript | ModuleScript): string | nil 15 | ``` 16 | 17 | ### Parameter 18 | 19 | - `script` - The `Script`, `LocalScript` or `ModuleScript` the bytecode would be obtained from. 20 | 21 | ### Example 22 | 23 | ```luau 24 | local AnimateScriptBytecode = getscriptbytecode(game.Players.LocalPlayer.Character.Animate) 25 | print(AnimateScriptBytecode) -- Returns a string with the bytecode. 26 | 27 | print(getscriptbytecode(Instance.new("LocalScript"))) -- Output: nil 28 | ``` 29 | 30 | --- 31 | 32 | ## getscripthash 33 | 34 | > [!NOTE] 35 | > Use the compressed and encrypted bytecode, don't decrypt and decompress it. 36 | > 37 | > This function should return `nil` if the script has no bytecode. 38 | > We encourage this behavior, as it's easier for people to check for `nil`, rather than each executor having its own output. 39 | 40 | Returns a `SHA384` hash represented in hex of the module/script's bytecode. 41 | 42 | ```luau 43 | function getscripthash(script: Script | LocalScript | ModuleScript): string | nil 44 | ``` 45 | 46 | ### Parameter 47 | 48 | - `script` - The script instance to get the hash of. 49 | 50 | ### Example 51 | 52 | ```luau 53 | local ScriptHash = getscripthash(game.Players.LocalPlayer.Character.Animate) 54 | print(ScriptHash) -- Should return a non-changing SHA384 hash in hex representation 55 | 56 | print(getscripthash(Instance.new("LocalScript"))) -- Output: nil 57 | ``` 58 | 59 | --- 60 | 61 | ## getscriptclosure 62 | 63 | Creates a new closure (function) from the module/script's bytecode. The game does not use the function you will get, as it's usually used to retrieve constants. 64 | 65 | ```luau 66 | function getscriptclosure(script: Script | LocalScript | ModuleScript): (...any) -> (...any) | nil 67 | ``` 68 | 69 | ### Parameter 70 | 71 | - `script` - The script instance to get its closure. 72 | 73 | ### Example 74 | 75 | ```luau 76 | local AnimateScript = game.Players.LocalPlayer.Character.Animate 77 | print(getscriptclosure(AnimateScript)) -- Output: function 0x... 78 | 79 | print(getscriptclosure(Instance.new("LocalScript"))) -- Output: nil 80 | ``` 81 | 82 | --- 83 | 84 | ## getsenv 85 | 86 | Returns the environment of the given script thread. 87 | 88 | ```luau 89 | function getsenv(script: Script | LocalScript | ModuleScript): { [any]: any } 90 | ``` 91 | 92 | ### Parameter 93 | 94 | - `script` - The module/script the function gets the globals table of. 95 | 96 | ### Example 97 | 98 | ```luau 99 | local ScriptEnv = getsenv(game.Players.LocalPlayer.Character.Animate) 100 | print(ScriptEnv.onSwimming) -- Output: function 0x... 101 | 102 | print(getsenv(Instance.new("LocalScript"))) -- Throws an error 103 | ``` 104 | 105 | --- 106 | 107 | ## getscripts 108 | 109 | Returns all the scripts in the game, CoreScripts should be filtered by default. 110 | 111 | ```luau 112 | function getscripts(): { Script | LocalScript | ModuleScript } 113 | ``` 114 | 115 | ### Example 116 | 117 | ```luau 118 | local DummyScript = Instance.new("LocalScript") 119 | 120 | for _, ValueScript in pairs(getscripts()) do 121 | if (ValueScript == DummyScript) then 122 | print(`Found the script {DummyScript}`) 123 | end 124 | end 125 | ``` 126 | 127 | --- 128 | 129 | ## getrunningscripts 130 | 131 | Returns all the running scripts in the caller's global state, CoreScripts should be filtered by default. 132 | 133 | ```luau 134 | function getrunningscripts(): { LocalScript | ModuleScript | Script } 135 | ``` 136 | 137 | ### Example 138 | 139 | ```luau 140 | local DummyScript = game.Players.LocalPlayer.Character.Animate 141 | local DummyScript2 = Instance.new("LocalScript") 142 | 143 | for _, ValueScript in pairs(getrunningscripts()) do 144 | if (ValueScript == DummyScript) then 145 | print(`Found the running script {DummyScript}`) 146 | elseif (ValueScript == DummyScript2) then 147 | print("Should never happen") 148 | end 149 | end 150 | ``` 151 | 152 | --- 153 | 154 | ## getloadedmodules 155 | 156 | Returns all the loaded modules in the caller's global state. 157 | 158 | ```luau 159 | function getloadedmodules(): { ModuleScript } 160 | ``` 161 | 162 | ### Example 163 | 164 | ```luau 165 | local DummyModule = Instance.new("ModuleScript") 166 | local DummyModule2 = Instance.new("ModuleScript") 167 | 168 | pcall(require, DummyModule) 169 | 170 | for _, ValueModule in pairs(getloadedmodules()) do 171 | if ValueModule == DummyModule then 172 | print(`Found the loaded {DummyModule}`) 173 | elseif ValueModule == DummyModule2 then 174 | print("Should never happen") 175 | end 176 | end 177 | ``` 178 | 179 | --- 180 | 181 | ## getcallingscript 182 | 183 | Returns the script that's running the current Luau code. This function only returns `nil` for executor threads, if a game thread sets their `script` global to `nil`, it must still return the correct `script`. 184 | 185 | ```luau 186 | function getcallingscript(): LocalScript | ModuleScript | Script | nil 187 | ``` 188 | 189 | ### Example 190 | 191 | ```luau 192 | local Old; Old = hookmetamethod(game, "__index", function(t, k) 193 | if not checkcaller() then 194 | local callingScript = getcallingscript() -- Should return a foreign script 195 | 196 | warn("__index called from script:", callingScript:GetFullName()) 197 | 198 | hookmetamethod(game, "__index", old) 199 | return old(t, k) 200 | end 201 | end) 202 | 203 | print(getcallingscript().Name) 204 | ``` 205 | 206 | --- 207 | 208 | ## loadstring 209 | 210 | Compiles the given string, and returns it runnable in a function. The environment must become `unsafe` after this function is called due to it allowing the modification of globals uncontrollably (see [setfenv](https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#setfenv)/[getfenv](https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#getfenv) documentation [*Enable Deprecated Functions to View them*]) 211 | 212 | ```luau 213 | function loadstring(src: string, chunkname: string?): ((A...) -> any | nil, string?) 214 | ``` 215 | 216 | ### Parameters 217 | 218 | - `src` - The source to compile. 219 | - `chunkname` - Name of the chunk. 220 | 221 | ### Examples 222 | 223 | ```luau 224 | loadstring([[ 225 | Placeholder = {"Example"} 226 | ]])() 227 | 228 | print(Placeholder[1]) -- Output: Example 229 | ``` 230 | 231 | ```luau 232 | local Func, Err = loadstring("Example = ", "CustomName") 233 | 234 | print(`{Func}, {Err}`) -- Output: nil, [string "CustomName"]:1: Expected identifier when parsing expression, got 235 | ``` 236 | -------------------------------------------------------------------------------- /Libraries/Signals.md: -------------------------------------------------------------------------------- 1 | # Signals 2 | 3 | Functions that allow interaction with RBXScriptSignals and RBXScriptConnections. 4 | 5 | --- 6 | 7 | ## getconnections 8 | 9 | > [!NOTE] 10 | > Passing a C-Signal or a foreign signal into **getconnections** should return `Function` and `Thread` as nil into their connections, due to them not being accessible. 11 | 12 | Returns the connections of the specified signal. 13 | 14 | ```luau 15 | function getconnections(signal: RBXScriptSignal): {Connection} 16 | ``` 17 | 18 | ### Connection 19 | 20 | | Field | Type | Description | 21 | | ----- | ---- | ----------- | 22 | | `Enabled` | boolean | Whether the connection can receive events. | 23 | | `ForeignState` | boolean | Whether the function was connected by a foreign Lua state (i.e. CoreScripts, Actors). | 24 | | `LuaConnection` | boolean | Whether the connection was created in Luau code. | 25 | | `Function` | function? | The function bound to this connection. Nil when `ForeignState` is true, or `LuaConnection` is false. | 26 | | `Thread` | thread? | The thread that created the connection. Nil when `ForeignState` is true, or `LuaConnection` is false. | 27 | 28 | | Method | Description | 29 | | ----- | ----------- | 30 | | `Fire(...: any): ()` | Fires this connection with the provided arguments. | 31 | | `Defer(...: any): ()` | [Defers](https://devforum.roblox.com/t/beta-deferred-lua-event-handling/1240569) an event to connection with the provided arguments. | 32 | | `Disconnect(): ()` | Disconnects the connection from the function. | 33 | | `Disable(): ()` | Prevents the connection from firing. | 34 | | `Enable(): ()` | Enables the connection, allowing it to fire. | 35 | 36 | ### Parameters 37 | 38 | - `signal` - The signal whose connections you want to retrieve. 39 | 40 | ### Examples 41 | 42 | ```luau 43 | local DummyFolder = Instance.new("Folder") 44 | DummyFolder.ChildAdded:Connect(function() return "Triggered" end) 45 | local connection = getconnections(DummyFolder.ChildAdded)[1] -- First connection in the returned table 46 | 47 | print(`{connection.Function()}, {type(connection.Thread)}`) -- Output: Triggered, thread 48 | ``` 49 | 50 | ```luau 51 | local CConnection = getconnections(game.Players.LocalPlayer.Idled)[1] 52 | print(`{CConnection.Function}, {CConnection.Thread}`) -- Output: nil, nil 53 | ``` 54 | --- 55 | 56 | ## firesignal 57 | 58 | Fires a signal's Lua connections. 59 | 60 | ```luau 61 | function firesignal(signal: RBXScriptSignal, ...: any?) 62 | ``` 63 | 64 | ### Parameters 65 | 66 | - `signal` - The signal to fire. 67 | - `...?` - The wanted arguments to pass into the fired connections. 68 | 69 | ### Example 70 | 71 | ```luau 72 | local part = Instance.new("Part") 73 | part.ChildAdded:Connect(function(arg1) 74 | print(typeof(arg1)) 75 | end) 76 | 77 | firesignal(part.ChildAdded) -- Output: nil 78 | firesignal(part.ChildAdded, workspace) -- Output: Instance 79 | ``` 80 | 81 | --- 82 | 83 | ## replicatesignal 84 | 85 | > [!NOTE] 86 | > For an accurate result from the example, test the function in [our game](https://www.roblox.com/games/122008870888915/boibiobioboiio). 87 | > 88 | > Also note that some signals might have different namings. For all the current replicable signals, visit [this](https://rubis.numelon.com/view/?scrap=AIOzG1Di7NSLADKE) 89 | 90 | If possible, replicates the signal to the server with the provided arguments. The arguments must also match accordingly to the signal itself. To know a signal's arguments, visit [this](https://robloxapi.github.io/ref/). 91 | 92 | 93 | ```luau 94 | function replicatesignal(signal: RBXScriptSignal, ...: any?) 95 | ``` 96 | 97 | ### Parameters 98 | 99 | - `signal` - The signal to be fired/replicated. 100 | - `...?` - The wanted arguments to pass into `signal`. 101 | 102 | ### Examples 103 | 104 | ```luau 105 | local Path = workspace.replicatesigmal 106 | replicatesignal(Path.ClickDetector.MouseActionReplicated, game.Players.LocalPlayer, 0) 107 | task.wait(0.1) 108 | print(game.Players.LocalPlayer:GetAttribute("MouseClickReplicated")) -- Output: true 109 | ``` 110 | 111 | ```luau 112 | local Path = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame 113 | replicatesignal(Path.MouseWheelForward) -- Throws an arg error 114 | replicatesignal(Path.MouseWheelForward, 121) -- Throws an arg error 115 | replicatesignal(Path.MouseWheelForward, 121, 214) 116 | task.wait(0.1) 117 | print(game.Players.LocalPlayer:GetAttribute("MouseWheelForwardReplicated")) -- Output: true 118 | ``` 119 | -------------------------------------------------------------------------------- /Libraries/WebSocket.md: -------------------------------------------------------------------------------- 1 | # WebSocket 2 | 3 | The **WebSocket** class provides a simple interface for sending and receiving data over a WebSocket connection. 4 | 5 | ## WebSocket.connect 6 | 7 | ```lua 8 | function WebSocket.connect(url: string): WebSocket 9 | ``` 10 | 11 | --- 12 | 13 | ### `WebSocket` Methods 14 | 15 | | Method | Description | 16 | | ------ | ----------- | 17 | | `Send(message: string): ()` | Sends a message over the WebSocket connection. | 18 | | `Close(): ()` | Closes the WebSocket connection. | 19 | 20 | ### `WebSocket` Events 21 | 22 | | Event | Description | 23 | | ----- | ----------- | 24 | | `OnMessage(message: string): ()` | Triggered when a message is received over the WebSocket connection. | 25 | | `OnClose(): ()` | Triggered when the WebSocket connection closes. | 26 | 27 | --- 28 | 29 | ### Example - `WebSocket.connect` 30 | 31 | ```luau 32 | local ws = WebSocket.connect("ws://echo.websocket.events") 33 | print(ws) -- Output: WebSocket 34 | ``` 35 | 36 | ### Example - `OnMessage, Send` 37 | 38 | ```luau 39 | local ws = WebSocket.connect("ws://echo.websocket.events") 40 | ws.OnMessage:Connect(function(message) 41 | print(message) 42 | end) 43 | ws:Send("Hello") -- Output: Hello 44 | ``` 45 | 46 | ### Example - `OnClose, Close` 47 | 48 | ```luau 49 | local ws = WebSocket.connect("ws://echo.websocket.events") 50 | ws.OnClose:Connect(function() 51 | print("Closed") 52 | end) 53 | ws:Close() -- Output: Closed 54 | ``` 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MOVED TO NEW DOCUMENTATION 2 | 3 | This is the repository for the old documentation. It is no longer in use, in favour of the new documentation. 4 | 5 | ## New Documentation at [docs.sunc.su](https://docs.sunc.su) 6 | - [Documentation Website](https://docs.sunc.su) 7 | - [GitHub Repository for docs.sunc.su](https://github.com/sUNC-Utilities/docs.sunc.su) 8 | 9 |
10 | Old README 11 | 12 | # sUNC Introduction 13 | 14 | ## What is "sUNC"? 15 | 16 | **sUNC** stands for **senS' Unified Naming Convention**. It's a tool designed to check if an executor can properly run essential global functions, following the existing [Unified Naming Convention](https://github.com/unified-naming-convention/NamingStandard/tree/main). 17 | Unlike the original UNC, which is now outdated and prone to spoofing, sUNC ensures that functions actually work as intended, by testing them as if they were to be used in a real scenario. 18 | However, we are not, in any way calling UNC "bad", we are simply saying people shouldn't be using UNC to deeply test their environment, as that is not its purpose. 19 | 20 | ## How would I know what fails? 21 | 22 | We are not gatekeeping function tests, despite the script being obfuscated. 23 | You are welcome to ask the owner (@sens6222 on Discord) if you are struggling with passing certain tests. We keep it this way for now, due to executors already faking their environments to suit the [original UNC](https://github.com/unified-naming-convention/NamingStandard/tree/main). 24 | 25 | Note that it's also possible to see the detailed reason of a function's failure at the top of the `Developer Console` in game. 26 | 27 | ## Will sUNC be discontinued? 28 | 29 | Not in the near future, we hope. However, if sUNC would be discontinued, we will open source the project after 1-2 months. 30 | 31 | ----- 32 | 33 | # Credits 34 | 35 | - [Original UNC Documentation](https://github.com/unified-naming-convention/NamingStandard/tree/main) 36 | 37 |
38 | --------------------------------------------------------------------------------