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?