This script is inside of a part that is inside of the player. It's supposed to damage other players that it comes in contact with. It's not doing any damage for whatever reason. What am I doing wrong? (Explanations please)
local deb = false
script.Parent.Touched:Connect(function(hit)
local OtherHumanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
local PlayersHumanoid = script.Parent.Parent:FindFirstChild("Humanoid")
if OtherHumanoid == PlayersHumanoid then OtherHumanoid = nil
if OtherHumanoid ~= nil then
if deb == true then return end
deb = true
OtherHumanoid.Health = OtherHumanoid.Health-50
wait(0.2)
deb = false
end
end
end)

3 comments
why would workspace have a humanoid (hit.Parent.Parent)
First make sure your script is not local. Other possibilty is that part is being bombarded with touch events from same character body parts..
@EXpodo1234ALT that's in case it accidentally hits an object like a hat.