Issue with hitboxes

Hi. So I’ve run into an issue. My script that I’ve been using for my hitboxes has a major bug that just… happens. I have no idea why and it shouldn’t be doing this. So basically, the hitboxes script only detects a single player at a time even though I want an AoE hitbox. Here’s what I’m using to detect the player in the hitbox:

for i,v in pairs(workspace:GetPartsInPart(script.Parent)) do
	if v.Parent:FindFirstChild("Humanoid") and v.Parent.Name ~= script.Parent.User.Value and v.Parent:FindFirstChild("1Hit"..script.Parent.User.Value) == nil then

		local x = Instance.new("IntValue", v.Parent)
		x.Name = "1Hit"..script.Parent.User.Value
		game.Debris:AddItem(x, 2)

If anyone could help that would be huge. Thank you!

I feel like I am missing a lot of the script. Is this the whole thing?

Judging from the little script that came with this post, you only run this once?
For an AoE hitbox i could also recommend Region3 to you by the way.

I imagine you are creating the instances to ensure that the same character does not receive damage multiple times in that attack.

I recommend creating tables instead of creating instances.

local Hit1 = {}
local Hit2 = {}

Every time your loop hits a player, add the player to the table while also checking if the target in question is inside the table.

So overlap functions have a max parts counter in them that you can change using the OverlapParams.
But I did read that the default value was no limit. But there is a FilterDescendantsInstances parameter that you definitely should be specifying for performance.

no there’s some stuff that damages the user and whatnot, but i didn’t think you’d really need that.

I don’t think changing the params would do anything if the default is unlimited.