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

How to i fix my starterplayer gui script?

Asked by 5 years ago

This question has been solved by the original poster.

I have a script in ServerScripts...

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        wait()
        c.Parent = game.Lighting
        p.PlayerGui.Health.Enabled = false
        p.PlayerGui.CharChoose.Enabled = true
    end)
end)

it wont work, i even tried adding a wait(5) and that gives me time to look in the player's PlayerGui, and the screengui is THERE! but there is output error saying

CharChoose is not a valid member of PlayerGui

Please help!

0
the c.Parent = game.Lighting works, but why wont gui thing work? i looked and its there, same name! CommanderCaubunsia 126 — 5y

2 answers

Log in to vote
0
Answered by
sheepposu 561 Moderation Voter
5 years ago
Edited 5 years ago

The need to use "WaitForChild"

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        wait()
        c.Parent = game.Lighting
        local gui = p:WaitForChild('PlayerGui')
        local health = gui:WaitForChild('Health')
        local charchoo = gui:WaitForChild('CharChoose')
        helath.Enabled = false
        charchoo.Enabled = true
    end)
end)
0
i understand but that cant be the case, remember? i said i tried using wait and it still did not work even though i checked and the guis werer there. whatever i figured it out anyway CommanderCaubunsia 126 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

This case is Closed, i will not respond to anything.

Answer this question