Trouble creating an animated door

Hello there, fellow developers!

I’ve recently run into an issue when creating an animated door. Basically, it isn’t fully animated. There are no errors or any other kind of messages in the output, and the only thing that has a functional animation is a door’s hinge - It rotates when the proximity prompt is triggered. I tried looking for help on DevForum, but I didn’t find anything.

Here’s how the door looks in the explorer:
image
All of the parts are anchored. WeldConstraint is connected ‘Part0 - Hinge’ and ‘Part1 - Door’ - I already tried replacing Part0 with Part1, which didn’t work.

And here’s the code:

local TweenService = game:GetService("TweenService")
local Hinge = script.Parent

local Goal = {
	CFrame = Hinge.CFrame * CFrame.Angles(0,math.rad(90),0)
}

local Goal2 = {
	CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
}

local tweenInfo = TweenInfo.new(1)

local doorOpen = TweenService:Create(Hinge, tweenInfo, Goal)
local doorClose = TweenService:Create(Hinge, tweenInfo, Goal2)

local isOpen = false

script.Parent.Parent.Door.ProximityPrompt.Triggered:Connect(function()
	if isOpen == false then
		doorOpen:Play()
		isOpen = true
	else
		doorClose:Play()
		isOpen = false
	end
end)

I can’t find a way to make it work, so I hope you can find the issue. I’m really sorry if the problem is extremely simple to resolve, and I was just too dumb to find it.

I think you should use animations.

Unanchor everything but the hinge.

Unfortunately, this doesn’t seem to work. Even after unanchoring every part, except for the hinge, and then triggering the ProximityPrompt - the door doesn’t move (But the hinge does as it previously would). The door just… well, falls when I walk into it.

Try Part0 as the door and Part1 as the hinge.

As I already noted in my post - I tried it, and it unfortunately didn’t work. I’ve just opened up the studio to make sure. The hinge rotates those 90 degrees as it should. The door on the other hand doesn’t.

Even after everything but the hinge is unanchored?

That sounds very much like the fault is in welding. Every part in the door should be unanchored and individually welded to the anchored hinge or some “middle-man” part (also unanchored), which is then welded to the hinge. I’ve managed to solve it successfully this way.

Yes, I performed two tests:

  • One: Two parts were anchored with every combination of WeldConstraint connections.
  • Two: Only the hinge was anchored, also used every combination of WeldConstraint connections (Those ‘Part0’ and ‘Part1’ things)

Hey! Sorry for responding so late, but guess whose idea managed to work - I put a weld in a door, connected it to the hinge, unanchored the door, and now it works! Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.