Hello. I’ve been trying for the better part of 30 minutes to try getting this door to work with no luck.
As you can see at the second door, it’s “stuck” and won’t open right away.
https://gyazo.com/c9ab6e87e16d6c3aa28fef4bc7d168aa
The doors are connected/move via attachments. The outer frame of the door doesn’t have canCollide on, so it’s not an issue of the door getting stuck. Here is the script and picture of the region3:
wait(2)
local marker = script.Parent
found = false
while wait(0) do
region = Region3.new(marker.Position - (marker.Size/2), marker.Position + (marker.Size/2))
local parts = game.Workspace:FindPartsInRegion3(region, marker)
for _,part in pairs(parts) do
if part.Parent:FindFirstChild("Humanoid") then
--open door
script.Parent.Parent.h.HingeConstraint.TargetAngle = -100
script.Parent.Parent.h2.HingeConstraint.TargetAngle = 100
found = true
end
end
if found == true then
found = false
wait(2)
--close door
script.Parent.Parent.h.HingeConstraint.TargetAngle = 0
script.Parent.Parent.h2.HingeConstraint.TargetAngle = 0
end
end