attempt to index local 'target' (a nil value)?
Asked by
6 years ago Edited 6 years ago
01 | handle.Touched:connect( function (hit) |
04 | if Mouse.Button 1 Down then |
05 | if humanoid and hit and not hit:isDescendantOf(person) and Mouse.Button 1 Down then |
06 | local target = hit.Parent:FindFirstChild( "Humanoid" ) |
07 | print ( "Target variable added." ) |
08 | target:TakeDamage(damage) |
09 | print ( "Target took damage!" ) |
12 | print ( "Hit Function Finished!" ) |
I can't really figure out why this is happening. The error happens on the line that says "target:TakeDamage(damage)". Any help?