Having issues with Region3

Hello!

I have been experiencing some issues with Region3 and getting the amount of players in an area.
I considered using :Touch Events to manage this, but will my experience with :Touch events so far and the proven unreliability on them, I had ignored it.

My goal is to give the players in the selected Region3 a score point every second they are in that area.

I tried to locate the error, and the possible Issue is that it is not picking up the objects in the Region3

local MapParts = game.Workspace.MapParts

local Players = game:GetService("Players")
local RepStore = game:GetService("ReplicatedStorage")
local SvrStore = game:GetService("ServerStorage")
local SvrScript = game:GetService("ServerScriptService")

local ServerDataMenu = require(RepStore.ServerData)

local Incall = SvrScript.DataManager.InCall

local RegionArea = ServerDataMenu.Reg

local AlreadyCounted = {}

local TotalToSend = {}

while true do
	wait(1)
	local PartsInArea = workspace:FindPartsInRegion3(RegionArea,MapParts)
	local Players = Players:GetPlayers()
	
	print(#PartsInArea)
	
	for i,v in pairs(PartsInArea) do
		local PossibleChar = v.Parent
		print(v)
		if table.find(Players,PossibleChar.Name) then
			local Player = table.find(Players,PossibleChar)
			if Player then
				local PlrID = Player.UserId
				local ToSend = {}
				ToSend.PlrId = PlrID
				ToSend.Type = "Score"
				ToSend.Value = 1
				print(PossibleChar.Name)
				table.insert(TotalToSend,ToSend)
			end
		end
	end
	local suc, err = pcall(function()
		Incall:Fire(TotalToSend)
	end)
	if suc then table.clear(TotalToSend) end
end

I have ditched Region3 and moved on to worldroot:GetPartInParts.

1 Like

I know you found a solution. But i’d recommend that you use this module Since it specializes in things like this. And makes it stupidly easy to do.