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

Why wont it stop damage?

Asked by
neoG457 315 Moderation Voter
8 years ago
local debounce = false

DMGPart.Touched:connect(function(part)
    local h = part.Parent:FindFirstChild("Humanoid")
    if h and not debounce then
        debounce = true
        h:TakeDamage(15)

print("Not Blocked")

    wait(0.8)
debounce = false

if h and h.WalkSpeed == 3 and not debounce then
h:TakeDamage(1)  

print("Blocked")

    wait(0.8)
debounce = false

end
    end
        end)

If the targets WalkSpeed is equal to 3 then the damage should be 1 however it wont work.

1 answer

Log in to vote
1
Answered by 8 years ago
local debounce = false

DMGPart.Touched:connect(function(part)
    local h = part.Parent:FindFirstChild("Humanoid")
    if h and (h.WalkSpeed == 3) and (not debounce) then
        h:TakeDamage(1)  
        print("Blocked")
        wait(0.8)
        debounce = false
    elseif h and (not debounce) then
        debounce = true
        h:TakeDamage(15)
        print("Not Blocked")
        wait(0.8)
        debounce = false
    end
end)
1
Provide some kind of explanation with your code, please. The asker isn't learning anything if you are just giving him raw code. grasheeno 70 — 8y
0
Will do. darkelementallord 686 — 8y
Ad

Answer this question