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

Why wont the Damage inflicted be 1?

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.

1 comment

0

You forgot to add the 'end's to end the Chunks. :)

1 answer

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

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