Answered by
6 years ago Edited 6 years ago
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:
03 | if script.Parent.Parent.Parent.Parent.Parent:FindFirstChild( "Humanoid" ) then |
04 | local Humanoid = script.Parent.Parent.Parent.Parent.Parent:WaitForChild( "Humanoid" ) |
05 | Humanoid.Changed:Connect( function () |
06 | script.Parent.Size = UDim 2. new((Humanoid.Health/Humanoid.MaxHealth), 0 , 1 , 0 ) |
10 | print ( "Can not found Humanoid!" ) |
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.