I am currently experimenting with Region3 right now and the detection seems very weird for me.
local Point1 = game.Workspace.Point1
local Point2 = game.Workspace.Point2
local region3 = Region3.new(Point1.Position, Point2.Position)
local Part = Instance.new("Part")
Part.Anchored = true
Part.CastShadow = false
Part.CanCollide = false
Part.TopSurface = Enum.SurfaceType.Smooth
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.Transparency = 0.5
Part.Material = Enum.Material.Neon
Part.BrickColor = BrickColor.new("Steel blue")
Part.Size = region3.Size
Part.CFrame = region3.CFrame
Part.Parent = game.Workspace
local ignoreList = {Point1, Point2, Part}
while wait(1) do
local region = workspace:FindPartsInRegion3WithIgnoreList(region3, ignoreList, 1000)
--region variable must be inside the while loop because it has to be updated every second, if it is outside, it will only
--run once and only get the first value it gets when the script starts.
for index, value in pairs(region) do
if value.Name == "HumanoidRootPart" then
print("E")
end
end
end
The script on top, works, as it detects a part named "HumanoidRootPart" and prints out something in response.
local Point1 = game.Workspace.Point1
local Point2 = game.Workspace.Point2
local region3 = Region3.new(Point1.Position, Point2.Position)
local Part = Instance.new("Part")
Part.Anchored = true
Part.CastShadow = false
Part.CanCollide = false
Part.TopSurface = Enum.SurfaceType.Smooth
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.Transparency = 0.5
Part.Material = Enum.Material.Neon
Part.BrickColor = BrickColor.new("Steel blue")
Part.Size = region3.Size
Part.CFrame = region3.CFrame
Part.Parent = game.Workspace
local ignoreList = {Point1, Point2, Part}
while wait(1) do
local region = workspace:FindPartsInRegion3WithIgnoreList(region3, ignoreList, 1000)
--region variable must be inside the while loop because it has to be updated every second, if it is outside, it will only
--run once and only get the first value it gets when the script starts.
for index, value in pairs(region) do
local root = value:FindFirstChild("HumanoidRootPart")
if root then
print("E")
end
end
end
However, for this script, it is meant to do the same thing, prints out something if it detects a part named HumanoidRootPart. But this doesn't seem to work. Can someone please tell me what I am doing wrong?

1 comment
Accept/Upvote if this helped