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

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

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.

2 comments

0

Did you forget to capitalize the N in the screengui? Is it in the right spot?

0

Everything in the post is exactly how I left it.(The Copy and Paste is Not always bad :3)

1 answer

✓ Accepted answer

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")

2 comments

0

I'l Try that

0

Thanks!

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