local player = game.Players.LocalPlayer if game.Workspace[player.Name].Humanoid.Health == 0 then script.Parent.Visible = false end
Error - Humanoid is not valid member of model
The script instantly runs as soon as the script is loaded, and the character and humanoid takes a bit longer to load, therefore the character and humanoid won't exist by the time the script runs.
Also, I'm guessing you're trying to detect when the player dies, so just use humanoid.Died instead of Humanoid.Health.
Example:
local plr = game.Players.LocalPlayer --assigning the player to the variable 'plr' local char = plr.Character or plr.CharacterAdded:Wait() --assigning the character to the variable 'char', and if doesn't exist by the time the script runs it'll run the 'or' statement, aka wait for the character to be added local hum = char:WaitForChild("Humanoid") --It will wait for the humanoid to be loaded, and assign it to the variable 'hum' hum.Died:Connect(function() --When the humanoid dies, run this function: script.Parent.Visible = false end)
What you could do is: as the script runs as soon as it is loaded which means the the humanoid might not have a chance to be loaded yet.
local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:wait() if Character and (Character.Humanoid.Health == 0) then script.Parent.Visible = false end