Hello. So, I was working on a game feature which changed the character’s idle animation after a certain button was pressed, and everything seemed swell until-
For some reason only action animations will override the idle, but the idle is overruling the movement animation.
Now, the circumstances are that
-
The Animations are being played through the server
-
It’s indeed an idle animation
-
I am not manipulating anything related to the states such as Speed > 1, but I’m not sure if that’d be the solution regardless, nor is it being controlled through a variable change.
For more information, here’s the script, and here’s the animation script.
function AnimationModule.getSingleAnimation(Humanoid, ChosenAnimation)
local Length = 0
local KeySequence = KeyProvider:GetKeyframeSequenceAsync(ChosenAnimation.AnimationId)
--print("Getting the Sequences and loading em")
local KeyFrame = KeySequence:GetKeyframes()
for i=1, #KeyFrame do
local Time = KeyFrame[i].Time
if Time > Length then
Length = Time
end
end
return Humanoid.Animator:LoadAnimation(ChosenAnimation), Length
end -- Credit to RedPly's it's a pretty solid animation system.
function StanceSwitch.Switches(Player, Count)
local BStance
local CStance
if Count == 1 then
Player:SetAttribute("CStance", FightStances[1])
local Anim, Length = AnimationModule.getSingleAnimation(Player.Character.Humanoid, script.Animations.StanceOneIdle)
Anim:Play()
elseif Count == 2 then
Player:SetAttribute("CStance", FightStances[2])
local Anim, Length = AnimationModule.getSingleAnimation(Player.Character.Humanoid, script.Animations.StanceTwoIdle)
Anim:Play()
--[[elseif Count == 3 then
Player[Stance] = Stances[3]
local Anim, Length = AnimationModule.getSingleAnimation(Player.Character.Humanoid, script.Animations.StanceThreeIdle)
Anim:Play()]]
end
end
-- the variables BStance and CStance are obselete, I'll be deleting them soon.