Region script doesn't reach specified conditions

So I have this script:

local TweenService = game:GetService("TweenService")

local position1 = Vector3.new(0.14, 3.775, 77.46) - (Vector3.new(13, 11, 9) / 2)
local position2 = Vector3.new(0.14, 3.775, 77.46) + (Vector3.new(13, 11, 9) / 2)

local tween1 = TweenService:Create(script.Parent.MainDoor, TweenInfo.new(.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = .8})
local tween2 = TweenService:Create(script.Parent.Window, TweenInfo.new(.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = .8})

local tween3 = TweenService:Create(script.Parent.MainDoor, TweenInfo.new(.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 0})
local tween4 = TweenService:Create(script.Parent.Window, TweenInfo.new(.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 0.55})

local Region = Region3.new(position1, position2)

local parts = workspace:FindPartsInRegion3(Region)

for i, part in pairs(parts) do
	local humanoid = part.Parent:FindFirstChild("Humanoid")
	if humanoid then
		print(humanoid.Parent.Name)
		tween1:Play()
		tween2:Play()
		repeat
			script.Parent.MainDoor.CanCollide = false
			script.Parent.Window.CanCollide = false
		until not humanoid
	end
	tween3:Play()
	tween4:Play()
	script.Parent.MainDoor.CanCollide = true
	script.Parent.Window.CanCollide = true
end

I’ve made a region using Vector3 properties, where it is going to be used to trigger humanoid activity. But for some reason it isn’t even reaching the print statement. What is causing this?

Hello again!
How often is this running? If it’s only running once at the start of the game, it won’t work. Try put it in a heartbeat loop.

Still doesn’t seem to work. For some reason it doesn’t even reach the print statement also

You should put this code specifically inside a loop like so:

game:GetService("RunService").Heartbeat:Connect(function()
	local parts = workspace:FindPartsInRegion3(Region)

	for i, part in pairs(parts) do
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		if humanoid then
			print(humanoid.Parent.Name)
			tween1:Play()
			tween2:Play()
			repeat
				script.Parent.MainDoor.CanCollide = false
				script.Parent.Window.CanCollide = false
			until not humanoid
		end
		tween3:Play()
		tween4:Play()
		script.Parent.MainDoor.CanCollide = true
		script.Parent.Window.CanCollide = true
	end
end)

EDIT: Try printing out every part it touches, too.

I have exactly done this. I also put a print(part.Name) statement to see every part. But the second print statement isn’t reached for some reason.