I want to instantly play a new Idle animation after changing the animationid
Problem?
After changing the idle animation id the old idle animation is still playing until you move or jump.
As you can see, the new animation only plays after you move.
I am guessing that the new idle animation doesnt play because of humanoidstatetype not changing?
What solutions have you tried so far?
I have tried searching on the Developer Hub but the only topic that came up was "Detect if player change animation"
Code (Server Script)
game.ReplicatedStorage.WeoponEquipEvent.OnServerEvent:Connect(function(Player, Character, WeoponName)
local IdleOne = Character.Animate.idle.Animation1
local IdleTwo = Character.Animate.idle.Animation2
local Walk = Character.Animate.run.RunAnim
local Jump = Character.Animate.jump.JumpAnim
local Fall = Character.Animate.fall.FallAnim
local Weopon = game.ReplicatedStorage.WeoponModels:FindFirstChild(WeoponName):Clone()
Weopon.Parent = Character
local Motor6D = Instance.new("Motor6D")
Motor6D.Parent = Character:FindFirstChild("HumanoidRootPart")
Motor6D.Name = "WeoponMotor6D"
Motor6D.Part0 = Character:FindFirstChild("HumanoidRootPart")
Motor6D.Part1 = Weopon.PrimaryPart
IdleOne.AnimationId = Weopon:FindFirstChild("Idle").AnimationId
IdleTwo.AnimationId = Weopon:FindFirstChild("Idle").AnimationId
Walk.AnimationId = Weopon:FindFirstChild("Walk").AnimationId
Jump.AnimationId = Weopon:FindFirstChild("Jump").AnimationId
Fall.AnimationId = Weopon:FindFirstChild("Fall").AnimationId
local EquipAnimation = Instance.new("Animation")
EquipAnimation.AnimationId = Weopon.Equip.AnimationId
Character.Humanoid:LoadAnimation(EquipAnimation):Play()
end)
You could try to get the current running tracks of every single animation, destroy it and use the animator to load the new ones. Or make sure your idle animation’s priority is idle.
What kind of plugin / method did you use? I mean I get how you used Moyer parts to match with the idle animation to bend the arm with the tool in the hand but what exactly did you do? If I where you I would play an animation for the arm, this makes it so the feast of the character can move and the arm is caring the sword on the players back.
I figured it out. Made it so that it would stop playing the old animation and start playing the new animation by changing humanoidstatetype after the weopon was equipped.