Forum > Coding >

How to add custom functions [How-To on C#] [WeAreDevs API]

Posts: 369

Threads: 61

Joined: Apr, 2018

Reputation: 0

Posted



In most the of APIs, there are missing functions like loadstring, getHttp, etc. And you may want to add custom functions (i.e. godMode(string playerName)), so to do these, there are two ways:

Appending a Lua script at the start of user's script
This might be the easiest way, but will only let you use the functionalities that are extra inside the Roblox Player. To begin, let's suppose that you have a "exec" function that serves as a Lua execution function. It will need a parameter, the script, of type String. Now let's add our custom functions!

public void customExec(string script){
string str = script;
string extraStr = "function hellowWorld () print(\"Hello World!\")"; // For example, we add a "helloWorld" function that prints "Hello World!"

str = extraStr + str;
exec(str);
}

Replace specific text with other string
Following the previous method, you can also replace "HelloWorld" by the content of it (What it executes.)
  • 0

Added

Revision: For ability to interact outside the ROBLOX Player, use the second one. Because Lua in only available in our ROBLOX clients and servers, so using C# is like a road between the Lua and the ouside as C# can handle the exploit and inject Lua.
  • 0

Posts: 3

Threads: 1

Joined: Aug, 2018

Reputation: 0

Replied

wth this is confusing af hmu on discord so i can understand better Gren#0387
  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )