Attempt to index nil with 'Humanoid"

The issue here, according to that error, is that torso.Parent doesn’t exist (nil). You can fix this by using your already existing unithumanoid variable, however it’s strange that it’s already destroyed by the time you’re attempting to apply damage.

Also, I would recommend looking into memory leaks and garbage collection. You’ll want to set your instance variables to nil when you’re done with them, or else they’ll never be garbage collected from memory.

1 Like