I need with region3s detection

Any errors in the output possibly?

No, After I run the script and I go inside of my region3 nothing even comes up on my output. It is supposed to print “found player in region” but it isn’t

How about you replace the last part with this

for _, part in pairs(partsInRegion) do
	if game.Players[part.Name] then
		print("We found a player")

remember i want to make this script work using the GetPlayerFromCharacter function also I tried that a few seconds ago that doesn’t print anything either

I think it might be because your not constantly checking if there is something inside of the region,

if that didnt make sense then maybe this will help you understand

Before your player can even get into the region, the script runs so fast that it didnt detect your player, if im right it would only detect something that was already inside of it

edit: So try putting a part inside of the region in studio then run the game and see if it works

That region won’t detect much, can you show the parts?
And it’s size

Try this on for size

while true do
	local partsInRegion = workspace:FindPartsInRegion3WithIgnoreList(region,IgnoreList,100)

	for _,part in pairs(partsInRegion) do -- loop through parts until player is one of them
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			print("Found player in region3!")
1 Like

So I tried your code and it worked perfectly fine for me so your code is fine.
I assume either you’re not in the region when this script runs or you have more than 100 parts in the region so it doesn’t return the character parts(Which is unlikely).

This works, but is there a way to make it work without the RunService?

Well @BenMactavsin just said it works for him perfectly, so maybe he could give you some pointers

What I did was I didn’t run the script before I was in the area and it worked perfectly fine.

Yeah thats exactly why it worked because what he was doing was running the script before he was in the region and it didnt have enough time to recognize him in the region

so I replaced the max parts with math.huge and it still didn’t work with my code. So the max parts isn’t the problem.

So by saying you didn’t run the script before I was in the area did you put it in a function or something?

The reason my code worked is because its constantly checking if the player is in the reason

Your not getting what I am trying to say, you have to use a loop when your constantly wanting to detect if a player it inside of the region

The only way your able to check something repeatedly is with a loop

I both used the studio command bar and put it in a script and set disabled property to false then set it to true when I started the test.

Of course you can put it in a function and connect that function to an event that you can fire at any given time or just put a delay at the start of the script so you can have time to go to the region.

But yeah, you will need to put it in some sort of loop if you want constant detection.

Just like a touched event its always listening for the player to touch the part

Consider using Zone+ by ForeverHD for more optimized and efficient Region3 detection

So what is the loop that works for this? I used the for loop to keep checking until player was one of them and it would print in the output but it didn’t.

You have to use a while loop, or just any loop that just repeat forever

1 Like