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

What is Require(ID) and how can I use it in a gui?

Title says it all, I have no clue where to begin and I know this is commonly used so it'd be great if somebody could help me.

1 answer

✓ Accepted answer

Require() is used in ModuleScripts. The Best way i could see you using it in a gui is to display user stats or updating text. but ModuleScripts can only be accessed by scripts.

Script in side of a Gui Lable.

Module = Require(workspace.ModueScript)
script.Parent.Text = Module.Example

ModuleScript

local module = {} -- this can be named what ever.
module.Example = "I can't think of any good text sorry"
return module

if the Module is named "MainModule" then upload it to roblox you can access the Module from anywhere. so for example

assetVersion

Module = Require(01360453596) -- asset id
script.Parent.Text = Module.Example --[[ does the same thing as up top but can be used from anywhere]]

I really hope this helps

2 comments

0

thanks a lot!

0

np

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