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

My hitbox script is not working. any idea why? EDIT:SOLVED

Asked by
Hero_ic 502 Moderation Voter
9 years ago

EDIT: I SOLVED IT ON MY OWN XD

So I made a hit script that is suppose to continuously hurt them until you are not touching them anymore well the hitbox I made anyway. I originally was using the touched function but that did not loop so I tried it this way but it still does not work can someone help please? ~Thanks KIHeros

~Script

local box = script.Parent
local dmg = 5

while true do
    for _, part in pairs(box:GetTouchingParts()) do
        if part.Name == "HumanoidRootPart" then
            part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - dmg + box.Multiply.Value --when swinging it does even more damage
        end
    end
    wait()
end

Answer this question