For more information on what a constant function is and is not, see how to use
LPH_NO_VIRTUALIZE.LRM_INIT_SCRIPT
This macro lets you run a piece of code before your script runs. It accepts a constant function.
It can be useful for displaying an “Enter a key” GUI, running anti-cheat bypasses, or anything else that must be executed before authentication. It works best when combined with the key check library.
Good usage
Good usage
Bad usage
Bad usage
Key input GUI example
Key input GUI example
For a full key system GUI, you can start from this template.To display an async key UI, block execution with a loop at the end of the init script. Otherwise, the script will continue without a key and kick the user with a “no key found” error.To run a bypass or any other code that doesn’t need to wait for user input, you don’t need the blocking loop. Just add your code directly, but keep the yield from the warning above.
Limitations
- You can’t reference upvalues inside an init script, because it is extracted from the obfuscated code and runs without them. Treat it as a completely separate context, and define every helper function or variable it uses inside it.
- There can be only one init script per script, so you can use this macro only once.
- The function you pass must be a constant. Do not pass a variable, e.g.
LRM_INIT_SCRIPT(handlerFn).
LPH_NO_UPVALUES
Wrap a hookfunction hook in LPH_NO_UPVALUES to fix the “hook has more upvalues than original” error, which happens due to obfuscation.
Before:
LPH_NO_UPVALUES is a constant function, not a variable.
If you want to give the function a name, wrap it first and then pass the result:
Other macros
LPH_NO_VIRTUALIZE: see Optimisation.LRM_SEND_WEBHOOKandLRM_SANITIZE: see Webhook Protection.
