Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't this damage script work?

Asked by 7 years ago

I added a localscript in my backpack and it makes a Part called SmokeE and it's supposed to do damage but when it touches a humanoid it doesn't do any damage help?

--This is a script inside of the localscript to make the part "SmokeE" do damage
local touched = false
script.Parent.Parent.Parent.Character.Torso:WaitForChild("SmokeE").Touched:connect(function(part)
    if not touched then
        touched = true
        local humanoid = part.Parent:findFirstChild('Humanoid')
        if humanoid then
        humanoid:TakeDamage(4)
        end
    touched = false
    end
end)

Answer this question