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 ?
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
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
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