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

Help with a Module Script?

Asked by 9 years ago
local FontLibrary = require(script.Parent:WaitForChild("FontLibrary")) 
local ExtendedTextLabel = require(script.Parent.FontLibrary:WaitForChild("ExtendedTextLabel")) -- ERROR HERE

FontLibrary:LoadFont(338119316)

local label = ExtendedTextLabel.new()
label.Name = "HUDText"
label.Font = "ObelixPro"
label.Text = "HI"
label.FontSize = 36
label.Position = UDim2.new(0,0,0,0)
label.Size = UDim2.new(1,0,0.15,0)
label.TextColor = Color3.new(1,1,1)
label.Parent = script.Parent.MainHUD

FontLibrary is not a valid member of PlayerGui It says FontLibrary is not a member of PlayerGui, when if I go into the players GUI it has it their. Please help

EDIT Requested module experienced an error while loading Error on line 4

1 answer

Log in to vote
1
Answered by 9 years ago

Given the circumstances, I'd say the problem is simply trying to index the PlayerGui for an object that hasn't loaded yet.

Try using the WaitForChild method on the PlayerGui to return then 'FontLibrary', like this:

local FontLibrary = script.Parent:WaitForChild("FontLibrary")

-- I also recommend doing the same thing for the "ExtendedTextLabel"
local ExtendedTextLabel = require(FontLibrary:WaitForChild("ExtendedTextLabel")
FontLibrary = require(FontLibrary)

Anything else that would cause an error would be from the code in the module itself. Remember to have a return value inside each module.

If you're still having trouble with it, let me know.

0
That just comes up with a new error. I have edited my question with the error that popsup with WaitForChild() NinjoOnline 1146 — 9y
0
Edited. It might be a problem inside your ExtendedTextLabel module. How2Script 105 — 9y
Ad

Answer this question