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

How to Damage Multiple Humanoids?

Asked by 5 years ago
Edited 5 years ago

So, I have ignored it up until this point, but, how would one target multiple humanoids within a script and not create massive lag? I have tried many times, but they never seem to work. Does anyone know how I should go about damaging multiple humanoids, instead of my codes damaging only one per debounce/charge?

Example:

--// Settings
local Damage = 25

    local Debounce = true
    FirePillar.Touched:Connect(function(h)
        if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce == true then
            Debounce = false
            local Enemy = h.Parent.Humanoid

            Enemy:TakeDamage(Damage)
        end
    end)
0
Try using the CollectionService to tag enemies as "Enemies", then loop through all the CollectionService objects that are tagged Enemies and check their magnitude in relation to the FirePillar. If you want an onTouch, then you need specific denounces per enemy hit. climethestair 1663 — 5y
0
Thank you! I started to study it a bit after your recommendation, do you know of anything that could help me learn it better/more efficiently? Mellodax 2 — 5y

Answer this question