Change the script.Parent.Parent.Parent.Parent.Parent.Humanoid for script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Humanoid") and you can use :FindFirstChild() for detect if finded the Humanoid
Here is your fixed script:
wait()
if script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid") then
local Humanoid = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Humanoid")
Humanoid.Changed:Connect(function()
script.Parent.Size = UDim2.new((Humanoid.Health/Humanoid.MaxHealth), 0, 1, 0)
wait()
end)
else
print("Can not found Humanoid!")
end
Remember, change the value with Server. for this use Server Scripts or RemoteEvents...
Hope it helped :D
Wiki pages:
FindFirstChild
WaitForChild
Errors? tell-me on comments.
1 comment
ServerScript inside a billboardgui insides 3 frames