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

How do you make a touched event that does an Area Of Effect of damage?

Asked by 6 years ago

Basically, I want multiple entities touched the same object and being affected by it at the same time. So something like group damage.

I've tried making a table of things that touched it and making the effect of all the objects on the table, but I realize I haven't done that right.

1 answer

Log in to vote
1
Answered by 6 years ago

You have the right idea

-- Get things that touched it

local list = {}

part.Touched:connect(function(h)
    if h.Parent:FindFirstChild("Humanoid") then
        list[#list+1] = h.Parent.Humanoid
    end
end)

-- Dish out damage
for i = 1,#list do
    list[i]:TakeDamage(50)
end
0
Thanks iGlaciem 72 — 6y
Ad

Answer this question