How to get vector 3 min and max for region 3

I don’t understand how would you get vector 3 min and the max for region3! I don’t know how I would calculate a part corner position or even make the correct size for region 3 like I want too! No tutorials help me : (.

For something like a mathematical formula for finding a region 3 min and max, we should be able to just find it on the dev forum.

Less complex version, doesn’t take into account rotation of a part:

Also a tutorial I found with the diagram explaining the above formula:

More complex version taking into account a parts rotation:

2 Likes

Ok! I will check those links out.

I tried making it so that if your in the region it makes you take damage but when I went out of the region I am still taking damage! Script:

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

while true do
local wparts = workspace:FindPartsInRegion3(region,part)
wait(0.25)
for i, part in pairs(wparts) do
if part.Parnt:FindFirstChild("Humanoid") ~= nil then
local char = part.Parent
char.Humanoid:TakeDamage(25)
wait(1)
end
local RS = game:GetService("RunService")

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

local damageMult = 2

local hums = {}

RS.Heartbeat:Connect(function()
	local parts = workspace:FindPartsInRegion3WithIgnoreList(region, {part})
	
	hums = {}
	
	if parts then
		for _, part in pairs(parts) do
			
			if part.Parent then
				local hum = part.Parent:FindFirstChildWhichIsA("Humanoid")
				
				if hum then
					if not table.find(hums, hum) then
						table.insert(hums, hum)
					else
						hum:TakeDamage(.01*damageMult)
					end
				end
				
			end

		end
	end
	
end)

This code worked for me, I rewrote yours a bit and added some checks. This works for all humanoids, so even if the humanoid isn’t named ‘humanoid’ it still detects it. This also accounts for players not in the zone.
The table is cleared every heartbeat and then is refilled with everyone still in the zone. You can also use the ignorelist table to add people who won’t be hurt by the zone, just place their character in the ignore table.

Hope this helps!

2 Likes

One last question if I wanted to do the opposite and make this a Safe zone I would do the opposite of the script and make it so that if the player is out of the region this would work.
(you don’t have to respond to this.)

1 Like