Problem detecting players in a certain area

So I am trying to do a script where all the people from the server must be in the Region3 area for the one part to disappear. This actually works for 1 and 2 players, but for 3 (and probably more) it just doesn’t work. It doesn’t want to detect 3 players in the area.
Here’s the script:

repeat wait() until #game:GetService("Players"):GetPlayers()>0
local players = game:GetService("Players")
local point1 = workspace.Test3.Part2
local point2 = workspace.Test3.Part1
local region = Region3.new(point1.Position,point2.Position)

function getPlayersInRegion()
	local t = {}
	local parts = workspace:FindPartsInRegion3(region)
	for _, v in pairs(parts) do
		local plr = players:GetPlayerFromCharacter(v.Parent)
		if plr and not table.find(t, plr) then 
			table.insert(t, plr)
		end
	end
	return t
end

while wait(0.1) do
	if  #game:GetService("Players"):GetPlayers()==#getPlayersInRegion() then
		workspace.Test3.VanishPart.Transparency=1
		end
end
1 Like

By default region3 has a limit part detection of 20. Try this.

local parts = workspace:FindPartsInRegion3(region,nil,math.huge)
3 Likes