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

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

Asked by 6 years ago

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)

0
This is because you’re cloning GUI’s and editing the `PlayerGui` from the server. User#19524 175 — 6y
0
Also can you post the hierarchy? Everyone says 'it is a valid member' but it’s probably not. User#19524 175 — 6y
0
Not probably not. It isn't parented to the Instance yet. Griffi0n 315 — 6y
0
^? User#19524 175 — 6y
0
did you try script.Parent:WaitForChild F4ULT1NTH3D4T4 226 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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")
0
This should be a comment. User#19524 175 — 6y
0
You enjoy doing that don't you incapaz, being picky ;) NoirPhoenix 148 — 6y
0
Thanks! Thepoint13 99 — 6y
0
No problem :) NoirPhoenix 148 — 6y
0
How am I picky. User#19524 175 — 6y
Ad

Answer this question