From d361a71ccf55881aeb68f4db8334d2beb6ce3706 Mon Sep 17 00:00:00 2001 From: royal0959 <70254342+royal0959@users.noreply.github.com> Date: Mon, 22 May 2023 17:09:50 +0700 Subject: [PATCH 1/2] fix stop enum not ending active animation --- src/Client/CharacterModel/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Client/CharacterModel/init.lua b/src/Client/CharacterModel/init.lua index d5db192..9d2a3b1 100644 --- a/src/Client/CharacterModel/init.lua +++ b/src/Client/CharacterModel/init.lua @@ -210,6 +210,10 @@ function CharacterModel:PlayAnimation(enum, force) self.playingTrack = track self.playingTrackNum = enum end + else + for _, value in pairs(tracks) do + value:Stop(0.1) + end end end end From 052dd598f1bd03a20dabc74d54cc9b4c1fc762dc Mon Sep 17 00:00:00 2001 From: royal0959 <70254342+royal0959@users.noreply.github.com> Date: Mon, 22 May 2023 17:17:06 +0700 Subject: [PATCH 2/2] cleaner fix --- src/Client/CharacterModel/init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Client/CharacterModel/init.lua b/src/Client/CharacterModel/init.lua index 9d2a3b1..200a5e9 100644 --- a/src/Client/CharacterModel/init.lua +++ b/src/Client/CharacterModel/init.lua @@ -182,6 +182,15 @@ end --you shouldnt ever have to call this directly, change the characterData to trigger this function CharacterModel:PlayAnimation(enum, force) + local tracks = self.tracks + + if enum == 0 then + for _, value in pairs(tracks) do + value:Stop(0.1) + end + return + end + local name = "Idle" for key, value in pairs(Enums.Anims) do if value == enum then @@ -195,8 +204,6 @@ function CharacterModel:PlayAnimation(enum, force) self.startingAnimation = enum else if (self.modelData) then - - local tracks = self.tracks local track = tracks[name] if track then if self.playingTrack ~= track or force == true then @@ -210,10 +217,6 @@ function CharacterModel:PlayAnimation(enum, force) self.playingTrack = track self.playingTrackNum = enum end - else - for _, value in pairs(tracks) do - value:Stop(0.1) - end end end end