Help with Region3

Problem is the region doesn’t work nor does v print and I don’t know why (this is my first time using region3)

I’m trying to achieve a region that goes in front of the player with the size of (6.6,2.8,3.8).

Code:


local Character = Player.Character
local Humanoid = Character.Humanoid

local Region = Region3.new(Vector3.new(6.6,2.8,3.8), Vector3.new(6.6,2.8,3.8))	
	local RTable = workspace:FindPartsInRegion3(Region, nil ,20)
	for i,v in pairs(RTable) do print(v)
		if v.Parent:FindFirstChild("Humanoid") and v ~= Character then
			if Combo == 1 or Combo == 2 or Combo == 3 or Combo == 4 then
					v.Parent.Humanoid:TakeDamage(Damage)
				
					        
	end
	end				
end
1 Like

Since Region3.new takes in Vector3 bounds of a the rectangular prism volume.
so instead of using Region3.new(Vector3.new(6.6,2.8,3.8), Vector3.new(6.6,2.8,3.8)) (since this gets nothing), you should use:
local Size = Vector3.new(6.6,2.8,3.8);
local pos = Character:WaitForChild(‘HumanoidRootPart’).CFrame*CFrame.new(0,0,-Size.Z/2).p;
local Region = Region3.new(pos - (0.5 * Size), pos + (0.5 * Size));

4 Likes

The hitbox works but it damages me aswell:

local Size = Vector3.new(6.6,2.8,3.8);
local pos = Character:WaitForChild("HumanoidRootPart").CFrame*CFrame.new(0,0,-Size.Z/2).p;
local Region = Region3.new(pos - (0.5 * Size), pos + (0.5 * Size));
	local RTable = workspace:FindPartsInRegion3(Region, nil ,20)
	for i,v in pairs(RTable) do print(v)
		if v.Parent:FindFirstChild("Humanoid") and v ~= Character then
			if Combo == 1 or Combo == 2 or Combo == 3 or Combo == 4 then
					v.Parent.Humanoid:TakeDamage(Damage)
					        
	end
	end				
end

Well since RTable returns parts (not models); so instead of having if v.Parent:FindFirstChild(“Humanoid”) and v ~= Character then try using:
if v.Parent:FindFirstChild(‘Humanoid’) and v.Parent ~= Character then