Answered by
6 years ago Edited 6 years ago
Here's a joke:
The patient says:
"It hurts when I raise my arm like this."
Then the doctor says:
"Then don't raise your arm like that".
If it says h is a nil value, it's a nil value.
Apparently, at line 5 part.Parent:FindFirstChild("Humanoid")
is being ran before the Humanoid exists.
Try using WaitForChild()
instead of FindFirstChild()
so it'll wait until the object is there.
But if you still want to use FindFirstChild()
, you can run h:LoadAnimation()
AFTER you check if the h is not nil (if h~=nil then
).