Region3 not detecting character/player

  1. What do you want to achieve?
    A working region3 that detects the player/character.

  2. What is the issue?
    The region3 isn’t detecting me when I go inside of it.

  3. What solutions have you tried so far?
    I checked to see if the size of the region3 was actually what it was supposed to be, and it was.

local part = script.Parent

local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)

local parts = workspace:FindPartsInRegion3(region, part, 20)

while wait(1) do
	for i, part in pairs(parts) do
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			print(player.Name)
		end
	end
end
1 Like

Maybe check another print() statement that every Part that’s inside the region is actually being printed?

local part = script.Parent

local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)

local parts = workspace:FindPartsInRegion3(region, part, 20)

while wait(1) do
	for i, part in pairs(parts) do
        print(part)
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			print(player.Name)
		end
	end
end

Nothing printed

https://gyazo.com/474497d529755395e2553545d95a5505

The issue might be that you set a cap to 20. You can set it to math.huge, and it should fix it.

Still no result. And if you’re wondering why it isn’t printing out the baseplate it’s because I slightly lifted it above the ground.

Put the FindPartsInRegion3 call inside of the loop, otherwise, it will only get the parts on runtime.

1 Like

Try to constantly run get parts in regoin.

local part = script.Parent

local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)

local parts = workspace:FindPartsInRegion3(region, part, 20)

while wait(1) do
        parts = workspace:FindPartsInRegion3(region, part, 20)
	for i, part in pairs(parts) do
        print(part)
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			print(player.Name)
		end
	end
end
1 Like