remaking my hitboxes to support hitting multiple people, how do i prevent this from detecting the same person/limb
function hitboxmodule.createnonweld(player,hitboxtype)
local character = player.Character
if hitboxtype == "PlayerHitBox" then
local whohit = {}
local filterObjects = {character,game.Workspace.Map,whohit}
local boxCFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-1)
local boxSize = Vector3.new(3, 5, 3)
--local maxObjectsAllowed = 3 -- max objects allowed
local params = OverlapParams.new()
-- params.CollisionGroup = "Default"
params.FilterDescendantsInstances = filterObjects
params.FilterType = Enum.RaycastFilterType.Exclude
--params.MaxParts = maxObjectsAllowed
local objectsInSpace = workspace:GetPartBoundsInBox(boxCFrame,boxSize,params)
for i, obj in pairs(objectsInSpace) do
local objmodel = obj:FindFirstAncestorOfClass("Model")
if obj:FindFirstAncestorOfClass("Model") then -- char
print(obj:FindFirstAncestorOfClass("Model").Name)
table.insert(whohit, obj:FindFirstAncestorOfClass("Model"))
end
end
return whohit
end
end