Im trying to create a system that changes your animation from Idle to a Holding a Sword Animation when you pull your sword out of your inventory.
But, the animation does not change until you move around a bit. How would you have the animation change as soon as you take it out of your inventory? Thanks!
So far I have tried changing the animation start time and making a seperate animation that pull the sword out but no luck. I have looked around Dev Forum and any fixes never worked or are not for this specific problem. Can anyone help?
Here is my code: (I’m not sure how to nicely post code without Copy and Paste, Sorry)
Summary
local plr = script.Parent.Parent.Parent
local char = plr.Character
local IdleAnim1 = char.Animate.idle.Animation1.AnimationId
local IdleAnim2 = char.Animate.idle.Animation2.AnimationId
local WalkAnim = char.Animate.walk.WalkAnim.AnimationId
local RunAnim = char.Animate.run.RunAnim.AnimationId
local HoldAnim = char.Humanoid:LoadAnimation(script.HoldAnim)
local IdleAnim = char.Humanoid:LoadAnimation(script.IdleAnim)
script.Parent.Equipped:Connect(function()
print(“Weapon Equipped”)
char.Animate.idle.Animation1.AnimationId = “rbxassetid://8501284966”
char.Animate.idle.Animation2.AnimationId = “rbxassetid://8501284966”
char.Animate.walk.WalkAnim.AnimationId = “rbxassetid://8493411070”
char.Animate.run.RunAnim.AnimationId = “rbxassetid://8493411070”
HoldAnim:Play()
HoldAnim:Stop()
print(“IdlePlayed1”)
end)
script.Parent.Unequipped:Connect(function()
print(“Weapon Unequipped”)
char.Animate.idle.Animation1.AnimationId = IdleAnim1
char.Animate.idle.Animation2.AnimationId = IdleAnim2
char.Animate.walk.WalkAnim.AnimationId = WalkAnim
char.Animate.run.RunAnim.AnimationId = RunAnim
IdleAnim:Play()
IdleAnim:Stop()
print(“IdlePlayed2”)
end)