attempt to index local 'humanoid' (a nil value)
local removeHealth = false
script.Parent.Touched:connect(function(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
removeHealth = true
end
while removeHealth == true do
wait(1)
local CurrentHealth = humanoid.Health
local HealthToRemove = 12
CurrentHealth = CurrentHealth.Value - HealthToRemove
end
script.Parent.TouchEnded:connect(function(otherPart)
if humanoid then
removeHealth = false
end
end)
end)
Any help?

1 comment
Is this error occurring after you're killed, before, or during?