Im trying to make a tool that summons a hitbox, check the parts inside the hitbox and then deal the damge, but i am with a problem, when it detect more parts of the body it deals the damage again like, i set the damage to 10, if it hits only the arm it deals 10 damage, but if it gets the arm and the torso it deals 20, i dont want this, i want only to 10 dont matter how many parts of the same body it gets
Here is the script:
local evento = game.ReplicatedStorage.Weapons.Axe.Damage
local runservie = game[âRun Serviceâ]
local debris = game.Debrisevento.OnServerEvent:Connect(function(player, hit)
wait(0.25)
local character = player.Character
local rootpart = character:WaitForChild(âHumanoidRootPartâ)
local hitbox = game.ReplicatedStorage.Weapons.Axe.Damage.AxeBox:Clone()
hitbox.Parent = workspace.Ignore
hitbox.CFrame = rootpart.CFrame * CFrame.new(0,0, -3)
local damage = game.ReplicatedStorage.Weapons.Axe.Damage.Damage.Valuelocal socoOverlapParams = OverlapParams.new() socoOverlapParams.FilterType = Enum.RaycastFilterType.Blacklist socoOverlapParams.FilterDescendantsInstances = {workspace.Ignore,character} local hitpart = workspace:GetPartsInPart(hitbox,socoOverlapParams) if #hitpart ~= 0 then local hitou = {} for i, v in pairs(hitpart) do local humanoid = v.Parent:FindFirstChild("Humanoid") if humanoid then if not table.find(hitou,humanoid) then humanoid:TakeDamage(5) end end end end debris:AddItem(hitbox, 0.1)
end)