Region3, sometimes working and some other times not working

Hello, I’ve been making an “Objectives” system for my game,
image
it works by server scripts firing a remote event to every player, after that the local script in every player add the new “Objective” on their UI.

the Objectives can get completed when the players (click a designated part or enter in a designated “Region3”), so lets say that a player click on the needed button to complete his Objective after clicking another remote event would be called telling the local scripts to clear the Objective on the UI,

the first objective uses a Region3 to get completed:
Capture d’écran 2022-06-23 171955

the problem is that for some reason the reagion3 sometimes work and some other times does not:
here it worked:

and here it did not work, but it did worked if I reset in the region3 box

the region3 works with a simple sever script inside of the part:

local part = script.Parent 

local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)
local BillBoards = game:GetService("Workspace"):WaitForChild("Game"):WaitForChild("BillBoardParts")


while true do 
	local parts = workspace:FindPartsInRegion3(region, part)

	for i, part in pairs(parts) do
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then 
			print(player.Name)
			game.ReplicatedStorage.RemoteEvents.Players.ObjComplete:FireAllClients(player.Name,"Go to the conference room for further instructions",BillBoards:WaitForChild("ConfRoom"))
		end
	end

	wait(1)
end 

oh yes and also I checked the output and when it doesn’t work it does not print the player’s name so the problem should be in the region3 script…

1 Like

You can create a part and get the players inside of it, using workspace:GetPartsInParts().

2 Likes

You can also use :GetPartBoundsInBox() and won’t need to make a collision part.

:GetPartsInRegion3() is depreciated.

https://developer.roblox.com/en-us/api-reference/function/WorldRoot/GetPartBoundsInBox

I used it in a solution for another post.

1 Like
GetPartBoundsInBox()

Doesn’t receive a ‘Region3’ parameter.

My apologies. Edited for correction.

using the “GetPartsInParts()” seems to work, but the only thing that I dont understand is why was the region3 working only sometimes, was it a problem with the script or a roblox bug??