#script only damages one player at a time

30 messages · Page 1 of 1 (latest)

fiery spoke
#

Can u try this

#
while wait(2) do
    local hitbox = workspace:GetPartBoundsInBox(script.Parent.CFrame, Vector3.new(8, 6, 9))

    for _, v in pairs(hitbox) do
        if v.Parent then
            if v:IsA("BasePart") and v.Parent:IsA("Model") then
                if v.Parent:FindFirstChildOfClass("Humanoid") and v.Parent.PrimaryPart then
                    local hit = {}
                    if not hit[v.Parent] then
                        hit[v.Parent] = true
                        local distance = (v.Parent.PrimaryPart.Position - workspace.hitboxpart.Position).Magnitude

                        if 12 > distance then
                            for i = 1, 10 do
                                wait(0.1)
                                v.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(1.5)
                            end
                        end
                    end
                end
            end
        end
    end
end

#

does the dummies have the same name?

#

or the same parent

#

changes the name to maybe dummy1 and dummy2

#

something like that

#

whats the v parent?

#

leave the name like that, Dummy1 and Dummy2

#

And try this

#
while wait(2) do
    local hitbox = workspace:GetPartBoundsInBox(script.Parent.CFrame, Vector3.new(8, 6, 9))

    for _, v in pairs(hitbox) do
        if v.Parent then
            if v:IsA("BasePart") and v.Parent:IsA("Model") then
                if v.Parent:FindFirstChildOfClass("Humanoid") and v.Parent.PrimaryPart then
                    local hit = {}
                    if not hit[v.Parent.Name] then
                        hit[v.Parent.Name] = true
                        local distance = (v.Parent.PrimaryPart.Position - workspace.hitboxpart.Position).Magnitude

                        if 12 > distance then
                            for i = 1, 10 do
                                wait(0.1)
                                v.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(1.5)
                            end
                        end
                    end
                end
            end
        end
    end
end
quiet runeBOT
#

studio** You are now Level 1! **studio

fiery spoke
#
print(v.Parent.Name)
#

and send the output

#

then the sended script would work, thats weird

#

x6 ?

#

make sure everythings good

#

wait, put a print like this

#

and send output

#

open the table please, i cant see.

#

only dumm1 becomes true?

#

alright thats easy to fix

#

look

#

pass the script

#

to explain to you how to fix it, i dont have it.

#

try this

#
while wait(2) do
    local hitbox = workspace:GetPartBoundsInBox(script.Parent.CFrame, Vector3.new(8, 6, 9))
    local hit = {}

    for _, v in pairs(hitbox) do
        if v.Parent then
            if v:IsA("BasePart") and v.Parent:IsA("Model") then
                if v.Parent:FindFirstChildOfClass("Humanoid") and v.Parent.PrimaryPart then
                    if not hit[v.Parent.Name] then
                        hit[v.Parent.Name] = true
                        local distance = (v.Parent.PrimaryPart.Position - workspace.hitboxpart.Position).Magnitude

                        if 12 > distance then
                            coroutine.wrap(function()
                                for i = 1, 10 do
                                    wait(0.1)
                                    v.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(1.5)
                                end
                            end)()
                        end
                    end
                end
            end
        end
    end
end
#

coroutine.wrap create a function for only that v

#

have a good day!