✓ 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.
2 comments
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.
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.