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

Why wont the Damage inflicted be 1?

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(10)

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

You're meant to take 10 damage if your walkspeed is not equal to 3. However even when my walkspeed is equal to 3 it still inflicts 10 damage.

0
You forgot to add the 'end's to end the Chunks. :) TheeDeathCaster 2368 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

The problem is you didn't close your if statments, meaning you forgot to add an end, simple fix like so:

local debounce = false

DMGPart.Touched:connect(function(part)
    local h = part.Parent:FindFirstChild("Humanoid")

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

Hope this helped

Ad

Answer this question