My Magnitude Hitbox only detect 1 people

Idk why , my hitbox only detect 1 people everytime and i wanted to detect mutiplier people . so this is my script .

for i, v in pairs(workspace:GetDescendants()) do
	if v:IsA("Model") and v ~= Character and v:FindFirstChildWhichIsA("Humanoid") then
		local enemy = v
		if (Hitbox.Position - enemy.PrimaryPart.Position).Magnitude < 5.5 then
			if enemy:FindFirstChild("GetDamaged") and enemy:FindFirstChild("UsingMove") then
				if enemy.GetDamaged.Value == true then return end

				if Info1.HitSound and Info1.HitSound == "NormalHeavyHitSFX" then
					local Sound = Instance.new("Sound", enemy)
					Sound.SoundId = "rbxassetid://10828850073"
					Sound.Volume = 1
					Sound.MaxDistance = 100
					Sound:Play()

					deb:AddItem(Sound, Sound.TimeLength + 5)
				end

				print(enemy.Name)

				task.spawn(function()
					local FindFunction = NormalBasic[MoveName]
					if FindFunction then
						FindFunction(Character, enemy)
					end
				end)

				return enemy
			end

		end
	end
end	
3 Likes

Why are you returning something in the first place? The ‘return’ keyword breaks loops.

2 Likes

If you want to return hit enemies, add the enemy to a table and return that table after the loop.

Why not use WorldRoot:GetPartBoundsInBox ?

With it you can specify a blacklist or a whitelist for detectable parts.

It’s essentially an Area Raycast (BoxCast)
If your enemies are part of a specified folder you can also check if the thing hit is inside of that folder.