Door animation using roblox animation editor

  1. I want a door that can stay open for like 5min+ and only will close if I click the other button.

  2. The issue is that the door is opened and it just closes very fast, it should stay open but it closes.

  3. Looking on similar topics but can’t really find the same issue.

https://gyazo.com/617585680a5c14ff64df22f8d5d1a198

local door = game.Workspace:WaitForChild("Animated Door") --Locate the door in workspace
local debounce = false
local door1 = false
local animation = Instance.new("Animation") --Create the animation
animation.AnimationId="http://www.roblox.com/asset/?id=6115495997" --Get the animation from Roblox
local loadedAnimation = door.AnimationController:LoadAnimation(animation) --Load the animation to the controller
game.Workspace.Button.ClickDetector.MouseClick:Connect(function() --Connect a function when the ClickDetector is pressed
	if not debounce then
	debounce = true
	print("clicked")
	loadedAnimation:Play() --Play the animation
		wait(loadedAnimation.Length) --Wait till the animation is at the very end
		loadedAnimation:AdjustSpeed(0) --Pause the animation at the end
	debounce = false
	end
end)

game.Workspace.Button1.ClickDetector.MouseClick:Connect(function() --Connect a function when the ClickDetector is pressed
	if not debounce then
		debounce = true
		print("clicked")
		 --Play the animation
		wait(loadedAnimation.Length) --Wait till the animation is at the very end
		loadedAnimation:AdjustSpeed(-1) --Pause the animation at the end
		wait(loadedAnimation.length)
		loadedAnimation:AdjustSpeed(0)
		debounce = false
	end
end)

DoorAnimationTest (2).rbxl (21.1 KB)

There is no way to make it stay other than I guess changing the length to some ridiculous amount but that would be pretty impractical and overall not a good idea. I would suggest that you use TweenService. It would allow you to recreate the same effect with more customization.

Have you checked your animation? It is sliding towards the camera, then sliding sideways to open, but then it slides diagonally back to the start position. I think you’ve looped your animation back to the start position without realizing it.

Ah sorry about a late reply, but I ran into this problem myself. So basically you are on the right track by setting the animation’s speed to 0. However using a wait() can be unreliable due to lag which could cause the animation to end before the script stops waiting, if that makes sense.
The better ways are a but more complex, but if you want to stick with using wait() then you can just make the script wait for the loadedAnimation.Length - 0.05
This is so that the animation won’t reach the end (unless some sort of lag occurs), if the animation reaches the end it will stop playing which causes the doors to jump back to their original position.

Sorry if this might not make sense or if this reply was too late.