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

"Onee is not a valid member of ScreenGui" even though it is. Help?

https://gyazo.com/3c0d7b6e19d11dc394561fe5aae3d8ca

Everytime I start the game, it give the error "Onee is not a valid member of ScreenGui"

Even though it is in there. Here are the scripts.

game.Players.PlayerAdded:connect(function(plr)
	s = game.ServerStorage.ScreenGui:Clone()
	s.Parent = plr.PlayerGui
	
	while true do
		wait(0.01)
plr.PlayerGui.ScreenGui.TextLabel.Text = game.ReplicatedStorage.One.Value		
	end
	end)

2nd:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function()
		game.ReplicatedStorage.One.Value = game.ReplicatedStorage.One.Value + 1
	print(game.ReplicatedStorage.One.Value)
	
	if game.ReplicatedStorage.One.Value == 2 then
	game.Workspace.Part.BrickColor = BrickColor.new("Black")
	end

end)

3rd: Local Script

a = 0
script.Parent.Onee.MouseButton1Click:connect(function()
	if a < 1 then
		a = 1
		game.ReplicatedStorage.One.Value = game.ReplicatedStorage.One.Value + 1
	print(game.ReplicatedStorage.One.Value)
	game.ReplicatedStorage.RemoteEvent:FireServer()
	end
	
	
end)

5 comments

0

This is because you’re cloning GUI’s and editing the PlayerGui from the server.

0

Also can you post the hierarchy? Everyone says 'it is a valid member' but it’s probably not.

0

Not probably not. It isn't parented to the Instance yet.

0

^?

0

did you try script.Parent:WaitForChild

1 answer

✓ Accepted answer

awwww i get this annoying error all the time and it is because UIs don't load in as fast as other items. So what you'll need to do is add a 'WaitForChild()'

E.G:

script.Parent:WaitForChild("Onee")

5 comments

0

This should be a comment.

0

You enjoy doing that don't you incapaz, being picky ;)

0

Thanks!

0

No problem :)

0

How am I picky.

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