Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont it stop damage?

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

✓ Accepted answer
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)

2 comments

1

Provide some kind of explanation with your code, please. The asker isn't learning anything if you are just giving him raw code.

0

Will do.

This discussion is preserved as it was. New answers, comments, and votes are closed.