attempt to index local 'humanoid' (a nil value)
01 | local removeHealth = false |
02 |
03 | script.Parent.Touched:connect( function (otherPart) |
04 | local character = otherPart.Parent |
05 | local humanoid = character:FindFirstChild( "Humanoid" ) |
06 |
07 | if humanoid then |
08 | removeHealth = true |
09 | end |
10 |
11 | while removeHealth = = true do |
12 | wait( 1 ) |
13 | local CurrentHealth = humanoid.Health |
14 | local HealthToRemove = 12 |
15 |
Any help?
You need to 'end' your script if the toucher is not a humanoid.
1 | if not humanoid then |
2 | return end |
3 |
4 | elseif humanoid then |
5 | removeHealth = true |
6 | end |