PlayerHealth is not a valid member of PlayerGui?

I feel like this is such a simple answer, and I’ve literally tried everything but alas, to no avail (And I am aware this topic has been covered a lot of times but I feel like my issue is far different)

Ok so, in 1 of my games I have 2 GUI’s that are located in the StarterGui before upon Playing, and a LocalScript to change everything relevant to those 2 GUI’s but for some reason, 1 of them aren’t visible to the client’s eye? Keeping in mind this:

  • The 2 GUI’s are a Intro Frame, and a HealthBar that I automatically disable on-respawn, but the HealthBar GUI does not change its properties for some reason

  • I’ve checked the Explorer, and the HealthBar GUI is parented to the Local Player

  • The LocalScript destroys the Character upon join after the GUI’s get changed, and the GUI’s have ResetOnSpawn set to false

  • The LocalScript is Parented to the Intro’s GUI, and I am using WaitForChild()

The code in a simple form:

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

for _, v in pairs(PlayerGui:GetChildren()) do
	print(v)
end

print(PlayerGui.PlayerHealth) --Errors at this point
print(PlayerGui.PlayerHealth.PlayerHPFrame)
PlayerGui.PlayerHealth.Enabled = false

What actually outputs:
image

Any help would be appreciated! :upside_down_face:

Try using

print(PlayerGui:WaitForChild("PlayerHealth"))
1 Like

Idk how but for some reason that worked oh my gosh, I am also getting strange Move warnings & Head detections but I can easily fix that

Thanks!

Np, you might also want to make it a variable, just to keep things a little more tidy.