I have had this problem for so long. I have made multiple posts about it, and whenever I think I finally figured it out, 10 more problems emerge. I just can’t get the animations working no matter what I do because Roblox doesn’t handle it right.
All I want to do is one very very simple thing: All I want to do is be able to change the idle and walking animations of players whenever I want to.
That’s it.
This is what I settled with at the beginning:
hit.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://8137104876"
hit.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://8137256167"
hit.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://8137256167"
That should work, but it doesn’t work properly because Roblox animation’s don’t play right. If you changed the walking animation while walking, then you would have to stop walking and start walking again in order for it to play, and vice versa.
Because of that, I looked up some help and finally got this:
hit.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://8137104876"
hit.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://8137256167"
hit.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://8137256167"
local AnimationTrack = hit.Parent:FindFirstChild("Humanoid"):LoadAnimation(hit.Parent.Animate.idle.Animation1)
AnimationTrack:Play()
local AnimationTrack = hit.Parent:FindFirstChild("Humanoid"):LoadAnimation(hit.Parent.Animate.walk.WalkAnim)
AnimationTrack:Play()
But this didn’t work either, because then the walking animation would always play, regardless if you are walking or not.
Then I changed it to this:
hit.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://8137104876"
hit.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://8137256167"
hit.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://8137256167"
if hit.Parent:FindFirstChild("Humanoid").MoveDirection == Vector3.new(0,0,0) then
local AnimationTrack = hit.Parent:FindFirstChild("Humanoid"):LoadAnimation(hit.Parent.Animate.idle.Animation1)
AnimationTrack:Play()
local AnimationTrack = script.Parent:FindFirstChild("Humanoid"):LoadAnimation(hit.Parent.Animate.idle.Animation2)
AnimationTrack:Play()
else
local AnimationTrack = hit.Parent:FindFirstChild("Humanoid"):LoadAnimation(hit.Parent.Animate.walk.WalkAnim)
AnimationTrack:Play()
end
But that still didn’t work sometimes for WHATEVER reason.
The main suspect for the animations never working is lag. Nothing but lag.
One very annoying thing is that I have almost 100 scripts in my game to change the animation, and every time I want to make 1 small change, I have to spend an HOUR copying and pasting it into every script then double checking over everything.
I change the animations from the server, not the client. I can’t change it now, because if I did then it would require an entire re-script of everything in the game, which would take days or maybe a week of constant work.
Please can somebody give me an animation script or method that is guaranteed to work at least 99% of the time. Nobody can understand how annoying and stressful this is, because every time I think I fixed it, it never is. My scripts have became super messy and unreadable, all because I can’t get this one simple goal working.
Just to clear things up: All of my animations are looped and set animation priority to core.
tl;dr: How do I change the idle and walking animations of a player from the server when I want to. (I suggest you read the whole thing so the story and context becomes more clear)