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

Require help?

Asked by 8 years ago

What does require do? I see a script with only "require(259230115)" inside it and it's in serverscriptservice with http enabled. It's able to make guis and such appear but the only coding that I found is that one line.

2 answers

Log in to vote
1
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

The keyword require is used to load module scripts so that they can be used inside of the given script.

The function require takes one variant argument, either a reference to a module script or an integer. The integer variant is used to load a module script by it's asset id, assuming it has been uploaded to the Roblox website.

See this wiki page for more information and usage examples.

0
So if i had a script on the roblox website that makes the baseplate blue and then I made a script and put require(TheIdOfWhateverScriptItWas) then it would make my baseplate blue? TheScriptingAccount 90 — 8y
0
If that script was a ModuleScript, then yes. BlackJPI 2658 — 8y
Ad
Log in to vote
-2
Answered by 8 years ago

Require makes it so the rest of the script won't run unless that object exists, so lets say that I do require(game.ReplicatedStorage.XP). That wouldn't run the rest of the script if XP didn't exist in ReplicatedStorage. You can only require things that are module scripts.

Answer this question