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

How would I add Fire to a function that kills on touch?

I want a brick to kill on touch, but also when killed to add fire to the player. Can anyone help me? This does not work.

script.Parent.Touched:connect(function(part)
	Instance.new("Fire")
    local h = part.Parent:FindFirstChild('Humanoid')
    if h then
        h.Health = 0
    end
end) 

1 answer

✓ Accepted answer

You have to specify the parent of the fire, in your case, you probably want to do Instance.new("Fire", part.Parent:FindFirstChild("Torso")) Also, unrelated, you might want to use BreakJoints() to the character model rather than setting the health to zero.

3 comments

0

How would I do that? I tried h:BreakJoints(), didn't work.

0

Never mind I did h.Parent:BreakJoints(), it worked.

0

Wouldn't TakeDamage(int) be better?

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