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

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

Asked by 9 years ago

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

Log in to vote
0
Answered by
Bloxks 30
9 years ago

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.

0
How would I do that? I tried h:BreakJoints(), didn't work. LordZerefu 30 — 9y
0
Never mind I did h.Parent:BreakJoints(), it worked. LordZerefu 30 — 9y
0
Wouldn't TakeDamage(int) be better? DrJonJ 110 — 9y
Ad

Answer this question