Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Region3 not working even though im in the region?

local R3 = Region3.new(Vector3.new(73, -math.huge, -85.5), Vector3.new(-71.5, math.huge, -224))
local humrootpart = {}

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
		table.insert(humrootpart, char.HumanoidRootPart)
		print(#humrootpart)
    end)
end)

while wait() do
	if humrootpart then
	print(#(workspace:FindPartsInRegion3WithWhiteList(R3, humrootpart, math.huge)))
        for _,touch in 		 pairs(workspace:FindPartsInRegion3WithWhiteList(R3,humrootpart,math.huge)) do
               print("touched")
        end
    end
end

It doesn't recognize i'm in the region 3, the print "print(#(workspace:FindPartsInRegion3WithWhiteList(R3, humrootpart, math.huge)))" prints 0 even when i'm 100% in the region. If anyone knows what I did wrong here please let me know.

3 comments

0

I figured out the second problem, You can't use math.huge for region3, try using a number instead, like -200 and 200

0

Can you mark my answer as an answer? would really apprectiate it

0

I'm not quite sure how to do that, lol. I will figure out how.

1 answer

	local R3 = Region3.new(Vector3.new(73, -math.huge, -85.5), Vector3.new(-71.5, math.huge, -224))

Thats the problem

The first parameter wants the smallest Vector3 amongst the 2 (The one on the bottom left lower corner) and then the second paramater wants the biggest (The one on the Top right upper corner)

So it should be written like this instead :

local R3 = Region3.new(Vector3.new(-71.5, -200, -224), Vector3.new(73, 200, -85.5))

Edited : U cant use math.huge for region3

5 comments

0

I see that being one error, although, even with that fix, it doesnt work.

0

Eh? i tried it myself and it works perfectly? Are you sure your character is in the right position?

0

I'm nearly 100% sure, I even placed two parts for reference. I will try playing around with it.

0

I figured out the second problem, You can't use math.huge for region3, try using a number instead, like -200 and 200

0

Alright, that was the problem, thanks again.

This discussion is preserved as it was. New answers, comments, and votes are closed.