Door Closing Acting Strange

My vehicle doors uses 3 animations (OpenDoor,IdleOpen,CloseDoor) but the doors are acting so strange when closing the first time, anyone know how I can fix this ?

Script:

OpenAnim = {10602600011} ----UselessLine
IdleAnim = “10602865062” ----UselessLine
CloseAnim = “10602961953” ----UselessLine
Human = script.Parent:WaitForChild(“Humanoid”)

while true do

local Anim = Human:LoadAnimation(script.Parent.Open)

Anim.Looped = false

Anim:Play()

wait(2)

local AnimIdle = Human:LoadAnimation(script.Parent.AnimationIdle)

AnimIdle.Looped = true

AnimIdle:Play()

wait(5)

AnimIdle:Stop()

local Anim3 = Human:LoadAnimation(script.Parent.Close)

Anim3.Looped = false

Anim3:Play()

wait(5)

end

Here is the video of the closing of the door
robloxapp-20220815-2249180.wmv (771.2 KB)

Can you tell us which line is closing the door im assuiming its the ones with Anim3 correct?

local Anim3 = Human:LoadAnimation(script.Parent.Close)

Anim3.Looped = false

Anim3:Play()

thats the closing line

OpenAnim = {10602600011} ----UselessLine
IdleAnim = “10602865062” ----UselessLine
CloseAnim = “10602961953” ----UselessLine
Human = script.Parent:WaitForChild(“Humanoid”)

local Status = false -- Door is not open to begin with

while true do
	if Status == false then
		local Anim = Human:LoadAnimation(script.Parent.Open)
		Anim.Looped = false
		Anim:Play()
		Status = true
		wait(2)
	end

	local AnimIdle = Human:LoadAnimation(script.Parent.AnimationIdle)
	AnimIdle.Looped = true
	AnimIdle:Play()
	wait(5)
	AnimIdle:Stop()

	if Status == true then
		local Anim3 = Human:LoadAnimation(script.Parent.Close)
		Anim3.Looped = false
		Anim3:Play()
		Status = false
		wait(5)
	end	
end

Try this

No , still not working , the doors are still glitching when closing for the first time

Heres the issue

First of all, from my experience you should not use animations for things like doors, use constraints like Motor6D or you can use CFrame if this is a non moving object, but im guessing your train will move so use Motor 6D and then use tween service

But if you decide to use animations anyways heres what you should fix

1 Do not put humanoids into the model
Instead use animation controllers, these work the same as a humanoid or Animator but they work on non humanoid models
https://developer.roblox.com/en-us/api-reference/class/AnimationController

2 If you use humanoids, Do not load the track into the humanoid
Humanoid.LoadAnimationTrack() is deprecated and causes issues with animations, so its most likely the reason why you are having this issue, instead put an Animator inside the humanoid and do
Humanoid.Animator.LoadAnimationTrack()
https://developer.roblox.com/en-us/api-reference/class/Animator

1 Like

Maybe you should of used tweens instead of animations to open the door?

1 Like