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

why isn't my sword isn't dealing any damage?

Asked by
4d0z 4
5 years ago

Here's the script in my sword:

script.Parent.Parent.Equipped:Connect(function()
    script.Parent.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            if hit.Parent.Name ~= script.Parent.Parent.Parent.Name then
                if script.Parent.Parent.CanDamage.Value == true then
                    hit.Parent.Humanoid:TakeDamage(22)
                end
            end
        end
    end)
end)

No errors pop up or nothing :v

1 answer

Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
5 years ago
Edited 5 years ago

First of all I recommend using a debounce within a script and not a value. And that’s basically all I can say because you didn’t really organize your script very well and it’s hard to know where everything is. Trying editing it and adding variables for most of the things. Also when you say if canDamage.value == true then u want to change canValue to false so it doesn’t damage the player over and over again. And the after a few seconds set it back to true. But yeah I would recommend a debounce within a script.

0
I am not able to understand much by that script where the error is. as said by @alphexus try adding debounce and also can u send and image of explorer nickatnyte_yutub -5 — 5y
Ad

Answer this question