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

Damage not working after i try to not include the player using it in damage?

its supposed to do damage to the person it touches beside the person creating the part(fireEmmit)

but it doesn't do damage at all when i have the and not character.RightHand part in it.

fireEmmit.Touched:Connect(function(Part)
   if Part.Parent:FindFirstChild("Humanoid") ~= nil and not Character.RightHand then
	local Human = Part.Parent:FindFirstChild("Humanoid")
	Human.Health = Human.Health -22
end

9 comments

0

Please use code blocks.

0

sorry moderators for my last question i didn't know that would get moderated

0

sorry i'm kinda new to coding what exactly are code blocks?

0

Click the Lua button, and on the question body, there will be tildes. Put your code in between the tildes.

0

like that?

0

No.

0

is this better sorry to waste your time

0

You had it the second time!!!

1 answer

✓ Accepted answer

###I tidied up your code a bit. You don’t need the ~= nil bit, ROBLOX Developer Hub says it’s inefficient. You also need to use not part.Parent:FindFirstChild"RightHand" to make sure there isn’t a RightHand.

fireEmmit.Touched:Connect(function(part)
    if part.Parent:FindFirstChild"Humanoid" then
        if not part.Parent:FindFirstChild"RightHand" then
            part.Parent.Humanoid:TakeDamage(22)
        end
    end
end)

2 comments

0

incapaz can you check my question? Else not functioning properly?

0

Thanks its finally working i'll try to make my questions my high quality if i make another one sorry

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