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

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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

0
thanks a lot! GlidingPlane 28 — 7y
0
np TheScriptKing 102 — 7y
Ad

Answer this question