Region3 not actually getting all players in a region3?

I’m having a problem where my Region3 check doesn’t actually get all the players, and thus causes problems further down my script, giving false readings

-- Get all the players characters
		for _, player in pairs(Players:GetPlayers()) do
			if not player.Character then continue end
			
			local Humanoid = player.Character:FindFirstChildWhichIsA("Humanoid")
			if not Humanoid then continue end
			
			if Humanoid.Health <= 0 then continue end -- Dead
			
			table.insert(AllCharacters, player.Character)
		end
		
		-- All the players inside the Region
		local PartsInRegion = workspace:FindPartsInRegion3WithWhiteList(
			Region,
			AllCharacters
		)
		--print("AllCharacters", AllCharacters, "PartsInRegion", PartsInRegion)
		-- Go through all the parts inside the Region
		for _, part in pairs(PartsInRegion) do
			if not part then continue end -- Part doesn't exist
			
			--if part.Name ~= "HumanoidRootPart" then continue end -- Not the HumanoidRootPart
			
			local Character = part.Parent
			
			local Player = Players:GetPlayerFromCharacter(Character)
			if not Player then continue end
			
			if table.find(PlayersInRegion, Player) then continue end -- Already in the table
			
			table.insert(PlayersInRegion, Player)
		end
		
		print(#PlayersInRegion)

It only prints 1 item (a weapon), even when both players were in the Region3

So I then get problems down here, where it’s not actually getting all the players, so when say 2 players are in the Region3, it only picks up 1

for _, part in pairs(PartsInRegion) do
	if not part then continue end -- Part doesn't exist
		
	if part.Name ~= "HumanoidRootPart" then continue end -- Not the HumanoidRootPart
			
	local Character = part.Parent
			
	local Player = Players:GetPlayerFromCharacter(Character)
	if not Player then continue end

    print(Player) -- Only prints 1 player
Name: maxParts
Type: int
Default: 20
Summary: The maximum number of BaseParts to be returned.

Isn’t this the root of the problem?
(I took it from DevHub)

1 Like