I have a weapon shealthing system in my game, but the animations does not update until players moves or updates their humanoid state in any way. This is especially annoying for my game since if the player shealths or unshealths, their animations stays the same until they move. This also affects the running animations since you can shealth while running. If you don’t stop moving, the animation won’t update. I’ve tried a few different methods of fixing this, but I can’t really get anything to work. My best solution so far is setting the player walkspeed to 0 when they shealth, but I don’t want it to work like that.
Here’s a video of what I mean
I change the animations by updating the animate scripts animations in the player’s character. Here’s the part that updates the id whenever the player shealths.
I don’t think your are getting my problem here. The problem isn’t about the weight of the animation. It’s that the roblox animate script only fire the functions to update and play animations when certain events (e.g. Humanoid.Running, Humanoid.Jumping, etc.) are activated. Because of this, the new animations from shealthing and unshealthing aren’t played until the script registers a change in the humanoid’s state.
Ok. I have different idle and run animations for all the weapons in my game. When I shealth and unshealth, I change the AnimationIds of the animations in the default animate script each character has. I’ve looked at the code inside the animate script and the running animation is tied to a Humanoid.Running function. Because of this, the new animations don’t play as the Humanoid.Running event doesn’t fire again until it detects the player stops moving.
Ok, I just made this change in the animate script. It correctly updates the animations on the client’s side, but not the server side. Can you explain why this doesn’t replicate to the server because I literally used the exact functions in the animate script to play the animations.
task.spawn(function()
repeat task.wait() until #script:GetChildren() >= 10
for i,v in pairs(script:GetChildren()) do
for i2, anim in pairs(v:GetChildren()) do
if anim:IsA("Animation") then
task.spawn(function()
anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
if anim.Name == "WalkAnim" and Humanoid.MoveDirection.Magnitude > 0 then
playAnimation("walk", 0.1, Humanoid,true)
if currentAnimInstance and currentAnimInstance.AnimationId == anim.AnimationId then
local speed = Humanoid.Parent.PrimaryPart.Velocity.Magnitude
if speed / 20 <= 1 then
setAnimationSpeed(1)
else
setAnimationSpeed(speed / 22)
end
end
pose = "Running"
end
if anim.Name == "Animation1" and Humanoid.MoveDirection.Magnitude <= 0 then
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.1, Humanoid,true)
pose = "Standing"
end
end
end)
end)
end
end
end
end)
It doesn’t seem to work for me. Also doesn’t loading an animation require you to use Humanoid.Animator:LoadAnimation()? If that’s the case, the humanoid would already have an animator before the server could load it’s animation.
This is so confusing because if I used the same functions as the animate script to play the animations, shouldn’t they all work and replicate to the server? I mean the animate script itself plays the animations fine, but if that is the case, why isn’t my part of the script replicating?