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

How to i fix my starterplayer gui script?

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!

1 comment

0

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

2 answers

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)

1 comment

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

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

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