I’ve been working on a crouch animation, and said crouch animation changes the walk/idle animation. However, the animation for idle doesn’t update until I move, and the animation for walking doesn’t update until I stop moving. Does anyone know how to fix this? I’ve tried stopping the player for one frame for the walking animation, but that causes the animation for crouching to glitch.
It’s like the TNT duplication glitch in Minecraft. The TNT is technically powered, but it doesn’t ignite until it is moved, which updates the TNT, causing it to ignite.
Here are some videos of what I mean:
Walking:
As you can see, the walk animation does not change until I stop moving for a good amount of time.
Idle:
As you can see, the idle animation does not change until I move for a good amount of time.
Is this something that is unsolvable, is there a solution to it, and if so, what is it? Also, is this a Roblox bug, or just something that’s supposed to happen? (I have tried stopping the player for exactly one frame, and that works for the walking, but it causes the beginning of the crouch animation to glitch out and make the character lean too far forwards.)
To make a crouch animation, you don’t need to update any animations. Just simply play it and your done. If that was the case, you’d have to update EVERY animation to do a single animation.
After crouching, I want to make the character stay crouched while still allowing them to walk around, and that means that I do in fact have to change the walking/idle animation.
local char = game.Players.LocalPlayer.Character
script.Parent.MouseButton1Click:Connect(function()-- put a function you want to trigger here
char.Animate.walk.WalkAnim.AnimationId = "whatever your animation id is"
end)
I know how to change the animation, they just don’t update until I do something. For walking, it’s stop walking, for idle, it’s start walking. I want this to happen automatically without needing to do something like stopping the movement for one frame, as that glitches out the crouching animation.
-- add a function/ triggering thing here
crouchanim:Play()
char.Animate.walk.WalkAnim.AnimationId = "whatever your animation id is"
-- add a function/ triggering thing here
crouchanim:Stop()
char.Animate.walk.WalkAnim.AnimationId = "change it to roblox's animation id unless you have a custom walk animation"
The problem is that it doesn’t update until the player changes their movement. The animation changes, but doesn’t update automatically.
It’s like the TNT duplication glitch in Minecraft. The TNT is technically powered, but it doesn’t ignite until it is moved, which updates the TNT, causing it to ignite.
Another good example is how floating sand spawns, again in Minecraft. The sand will simply be floating, unaware that it should be falling, until something like a block placing makes the sand update itself, and it checks if it should be falling, and it goes “Oh. I should be falling right now.” It then falls, and then all of the other floating sand around it are updated, and the process is repeated.
Nope, reparenting it doesn’t change anything, and changing all of the character parts’ parent to the workspace and back to the character sort of works, but it also breaks quite a lot.
hello, you forgot to load the animation again, whenever you change an animation id you should remember to re-load the animation again.
local animation_object = Animation object here
animation_object.AnimationId = "rbxassetid://number here"
local loaded_anim = hum:LoadedAnimations(animation_object)
animation_object.AnimationId = "rbxassetid://crouch animation id" -- this thing updates the variable.
local loaded_anim = hum:LoadedAnimations(animation_object)--loads the animation once again.
even better to shorten this code:
just basically create a function that handles the animation.
function Animate(thing_to_animate, animationId, animator)
--first things off, "thing_to_animate" is the animation object
--you want the animationid to edit to.
--animationId is basically the id u want to give to the animation object.
--animator is basically the humanoid to load to or Animator to load to.
thing_to_animate.AnimationId = animationId
local new_animations = animator:LoadAnimation(thing_to_animate)
return new_animations
end
LoadedAnimations() seems weird, as in misstype?
are you referring to “LoadAnimation() is not a valid member of humanoid”? bcuz if so that’s impossible to show rarely; are you probably referring to “attempt to index nil with LoadAnimation()”?
if not neither of those two. then you had some misspell on your script.
LoadedAnimation() should be LoadAnimation()
EDIT: i found out; your loaded color looks blue so this mean it’s called as function not variable you should change the name into this: loaded_anim