I am trying to make this weapon that heals the player when their HP hits or is below a certain number, but the thing is, I keep getting an error. The error states that Humanoid is not a valid member of backpack. I've tried doing something like this before, but it worked perfectly. It is a normal script, and it is not a local script, although I have tried to convert it to local, and it still didn't work. What am I doing wrong?
script.Parent.Parent.Humanoid.HealthChanged:connect(function(hp)
if hp <= 0.01 then
print("Heal the player!")
script.Parent.Parent.Humanoid.Health = 10
wait(0.1)
end
end)

3 comments
thats because humanoid is in their character...?
just add .Parent.Character before .Humanoid
Thank you for the help, however, it only works for line 1. I tried it in line 5, and Output stated that "Character is not a valid member of Workspace". I tried removing a few of the parents, no luck.