Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Can anybody explain this? [ANSWERED]

Asked by 8 years ago

I have an interest in making a Anti-Exploit group, But that's not what I'm asking help on. My confusion is Whenever i enter another Anti-Exploit Service Loader script into serverscriptstorage and enable http, I only see a require() function in the script. I know require scripts are supposed to check if the object inside require exists before running the rest of the script, yet, At the same time, it seems like it Doesn't. Mainly because i see a function such as require(4327195436)

And that may seem like functional code to some of you other scripters out their, But this makes no sense. Because these numbers inside the require() function are fetching out local scripts and scripts outside of the game to make GUI's and everything functional. But to my understanding, Require() functions are supposed to make sure objects Inside the Workspace Exist.

Can anybody please explain?

Thanks, Tredicle

2 answers

Log in to vote
2
Answered by 8 years ago

I'm not quite sure what your asking, but for one, I would use FilteringEnabled to prevent exploits. FilteringEnabled is great, because its a built-in tool that prevents clients from editing anything server-side.

You can read up on FilteringEnabled more here: http://wiki.roblox.com/index.php?title=Client-Server_Model_and_FilteringEnabled

Now, let me explain how require() works real quick.

'require()' is a function used for accessing ModuleScripts. When you want to access code from a ModuleScript (a.k.a. Module), you need to first run it.

This is what it might look like if I have my ModuleScript in ReplicatedStorage:

Script

local Module = require(game.ReplicatedStorage.ModuleScript) --Runs our ModuleScript for the first time, returning a table.

Module:RunFunction() -- Calls function in the table returned from our ModuleScript

ModuleScript

local Module = {} --Creating a table named "Module"

function Module:RunFunction() --Adds a function called "RunFunction to our Module table
    print("RunFunction Running!")
end

return Module --Whenever this ModuleScript is called, it will always return our 'Module' table, along with all the functions we put in it.

Now, you should only use require() once per modulescript per script, as it will always return the same value. In this case, it happens to be a table.

You can learn more about require() and ModuleScripts here: http://wiki.roblox.com/index.php?title=Function_dump/Functions_specific_to_ROBLOX#require http://wiki.roblox.com/index.php?title=API:Class/ModuleScript

Hope this helps! If you have any questions after reading, let me know and I'll try to help. :)

0
Np. :) AwsomeSpongebob 350 — 8y
Ad
Log in to vote
3
Answered by 8 years ago

I'll put on the record that I am not a pro with all of the ins and outs of a Private Module but I do know some things.

First, when you're doing require(), you're able to have 1 of two things in between the parenthesis.

1) You can direct it to a Module inside of the game; E.X. require(game.Workspace.ModuleScript)

2) You can direct it to a Module on the ROBLOX Website by making the ModuleScript a Model, E.X. require(12345678). The numbers would be the Asset Id of the model on the website. If you name the ModuleScript "MainModule" everyone has access. If you don't, only you have access to the Module script.

Anyways, as you know, a Module Script doesn't really run the code by itself, a script must call upon a function that is inside of it. Now, I believe you're able to make things a Child of the Module Script that you call from its asset id, when you call it, your scripts and stuff inside of the Module can be used, causing that GUI to show and code to run.

if anyone else can better my answer, just add an answer or comment to this

0
This is a perfect answer aswell. Both answers are very good. Tredicle 30 — 8y

Answer this question