Help with doorway

I feel like I have to add a door but I also feel like adding a door that has collisions off is just too unrealistic. I also feel like having doors that stay open would feel kind of awkward and out of place. What should I do?

1 Like

#help-and-feedback:building-support

Also, you can make a door with hinge constraints.

I would use automated swinging doors. I made a script that does this. (I take lots of notes.) You can check it out of you want.

  1. make an attachment on door frame at hinge midpoint
  2. make an attachment on door at hinge midpoint
  3. select the door frame attachment and add a hinge
  4. rotate the hinges to the correct orientation in the editor
  5. use the following script. you might have to toy with the numbers.
local hingePart = script.Parent

local function getClosestPlayerDistance()
	local distance=math.huge
	for i, player in pairs(workspace:GetChildren()) do
		-- the player is really just the player's character
		if player:FindFirstChild("Humanoid") then
			distance = math.min(distance,(script.Parent.Position - player.HumanoidRootPart.Position).magnitude)
		end
	end
	if distance==math.huge then
		return nil
	else
		return distance
	end
end

while true do
	local PlayerDistance = getClosestPlayerDistance()
	hingePart.HingeConstraint.ActuatorType = Enum.ActuatorType.Motor
	hingePart.HingeConstraint.LimitsEnabled = true
	hingePart.HingeConstraint.LowerAngle = 0
	hingePart.HingeConstraint.UpperAngle = 135
	hingePart.HingeConstraint.MotorMaxTorque = 160
	if PlayerDistance then
		if PlayerDistance < 10 then
			hingePart.HingeConstraint.AngularVelocity=10
		end
		if PlayerDistance > 11 then
			hingePart.HingeConstraint.AngularVelocity=-10
		end
		--script.Parent.HingeConstraint.CurrentAngle = math.clamp((PlayerDistance - 10) / 5,0,1) * 90
	end
	wait()
end

Edit: If you have lots of doors, you probably want to attach the scripts using tags. to attach scripts using tags, make a script in server script service, like this.

local CollectionService = game:GetService("CollectionService")

for _, part in CollectionService:GetTagged("YOUR TAG") do
	-- do your stuff
end

To be honest, it looks weird without a door.

1 Like