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

A bug in LUA Scripting when locating a GUI button?[closed]

Asked by
Myaxp 3
9 years ago

When I was busy with my Menu, but when I ran it through a server it encountered a problem. First I will tell you where everything. I lay out my GUI like so:

Menu    (ScreenGui)
    LocalScript
    A   (About Button)
    N   (News Button) -----Where the problem is
    P   (Play Button)

But when I run a server it keeps saying, "N is not a valid member of ScreenGui". And it says its on Line "5"

Here is my script to locate "N"

--//Variables

Play = script.Parent.P
About = script.Parent.A
News = script.Parent.N ---- Here. Its going out of the script, to the Screen GUI and then into N.
click = game.Workspace.clicksound
hover = game.Workspace.hoversound
NGame = script.Parent.P.Frame.NG
CGame = script.Parent.P.Frame.CG

--//script
--And then My script is down here.
0
Did you forget to capitalize the N in the screengui? Is it in the right spot? My_Comment 95 — 9y
0
Everything in the post is exactly how I left it.(The Copy and Paste is Not always bad :3) Myaxp 3 — 9y

1 answer

Log in to vote
1
Answered by
KarlXYZ 120
9 years ago

Try adding "WaitForChild("")" to the end of your variables, sometimes the script will load in before any variables have been loaded.

An example would be:

News = script.Parent:WaitForChild("N")
0
I'l Try that Myaxp 3 — 9y
0
Thanks! Myaxp 3 — 9y
Ad

Answer this question