Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to use require?

So I seen where people can use EXAMPLE OF RDS(ROBLOX DEV SERVICES)

require(123)

and it hides there GUI coding, etc.. How do they do that exactly? What does require mean? I want to do the exact same thing but I do not understand this. If you would help me this is for my group just tell me how to use it, etc..

2 comments

0

I'm currently on my iPad so I can't easily type out a long answer, but the short answer is ModuleScripts. Look them up on the wiki.

0

require() is a function for Module Scripts, and ROBLOX has provided the functionality to use the require() function on assets on the ROBLOX website. These assets can then make changes to the game (this method is also used in hiding Scripth's admin commands.

2 answers

✓ Accepted answer

Going on to explain my comment,

require() is a function for Module Scripts, and ROBLOX has provided the functionality to use the require() function on assets on the ROBLOX website. These assets can then make changes to the game (this method is also used in hiding Scripth's admin commands.


The require function is used on Module Scripts. They are scripts that run once and that is when they are being called. With ROBLOX they have allowed for you to upload a module script to the site, and be able to run it in game.

Say I had a game setup like this.

  • game
    • Workspace
      • BasePlate
      • Script
        • Source: require(123456789)

Well, in the module script under the asset "123456789", say I had a script that said this:

print('This is a module script running code.')
local module = {}
return module

Well, when the script loads it will run the code in the module script, and functions can be ran through it as well when they are called. Though, that's a completely different question to ask.

######Hopefully this answer helped, if it did then remember to upvote and if it solved your problem do not forget to hit that Accept Answer button.

require() 

is used to load Module scripts ID's into game. --Hope this answered your question require() is a specific function

1 comment

0

I neutralized your answer. Reason being is that you have -11 rep. You can't afford to lose too many more of that. If you want to post a good answer, make sure you know what you're talking about, and go on to explain to others what the solution is.

This discussion is preserved as it was. New answers, comments, and votes are closed.