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

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

Asked by 5 years ago
Edited 5 years ago

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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0
Please use code blocks. User#19524 175 — 5y
0
sorry moderators for my last question i didn't know that would get moderated Waffle_Blox 3 — 5y
0
sorry i'm kinda new to coding what exactly are code blocks? Waffle_Blox 3 — 5y
0
Click the Lua button, and on the question body, there will be tildes. Put your code in between the tildes. User#19524 175 — 5y
View all comments (5 more)
0
like that? Waffle_Blox 3 — 5y
0
No. User#19524 175 — 5y
0
is this better sorry to waste your time Waffle_Blox 3 — 5y
0
You had it the second time!!! User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
0
incapaz can you check my question? Else not functioning properly? mixgingengerina10 223 — 5y
0
Thanks its finally working i'll try to make my questions my high quality if i make another one sorry Waffle_Blox 3 — 5y
Ad

Answer this question