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

[SOLVED BY ME]Script is not damaging the second humanoid?

Asked by 5 years ago
Edited 5 years ago

This question has been solved by the original poster.

The script I'm using could be incorrect or wrongly timed. I have no clue, so could anyone help? Here's the script.

local weapon = script.Parent.Parent.Handle.HitPart
local dmg = script.Parent.Parent.Interval.Value * 50 -- Damage

weapon.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        humanoid:TakeDamage(dmg)
        script:Destroy()
        if dmg then
            dmg:Destroy()
        end
    end
end)

I hope this gets answered. Also, can anyone also tell me what debounce is? Because this script is a free model, but I want to learn about it. Thanks.

Edit: Okay, I fixed it. Feel free to make any suggestions or possibly, tell me what in the world a debounce is.

1 answer

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
5 years ago

Hey, no answer on your script but answer on your question on debounce! Debounce is something we use to make a cooldown. Here's an example!

debounce = true

if debounce == true then
    debounce == false
    wait(1)
    debounce = true
end

If it's still not clear, here's another example!

block = script.Parent
debounce = true              --Debounce can be called anything!

block.Touched:connect(function(hit)
    if debounce == true then        --This checks if the cooldown is ready
        debounce = false        --This starts the cooldown
        block.BrickColor = BrickColor.Random()
        print(hit)
        wait(2)                 --This is how long the cooldown lasts
        debounce = true     --This ends the cooldown
    end
end)
0
Thank you! Now I understand! Sensei_Developer 298 — 5y
Ad

Answer this question