Issue with animation when animation id changes

Hello, I’m making somekind of battleground game, and I’m currently working on animations on equipped and unequipped animations when the player equips, walk/idle/jump/and more movement animation changes. Does the same as when player unequips, the animation swaps. What I did is when the equipping/unequipping animation event reaches, then the animation id of each movements changes.

(My english kinda make you a bit confuse.)

The problem is the animation of other players from the player’s view aren’t what I expected. Walk animation loops on idle, arms/legs misplaced. The bug shows on server aswell. This happen when the animation id changes. Here’s what I mean :

ANIMATION BUG :

UpdateAnimation LocalScript :

local player = game.Players.LocalPlayer
local character = player.Character
local hum : Humanoid = character:FindFirstChild("Humanoid")
local humrp = hum.RootPart

for i,v in pairs(character:FindFirstChild("Animate"):GetDescendants()) do
	if v:IsA("Animation") then
		v:GetPropertyChangedSignal("AnimationId"):Connect(function()
			hum:ChangeState(Enum.HumanoidStateType.Landed)
		end)
	end
end

I’ve tried changing humanoid state, disabling animate script and enable it back, stopping all active animations, looking for solution of other posts. None of them work for me. I’ve been finding solution for 5 hours straight. (Please don’t ask me why so long)

1 Like
  • FindFirstChild(“Animate”) may return nil
  • Changing AnimationId isn’t directly related to landing
  • ChangeState(Enum.HumanoidStateType.Landed) May Not Have a Visible Effect.

Maybe this can work:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:FindFirstChildOfClass("Humanoid")

if hum and character:FindFirstChild("Animate") then
    for _, anim in ipairs(character.Animate:GetDescendants()) do
        if anim:IsA("Animation") then
            anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
                if hum:GetState() ~= Enum.HumanoidStateType.Seated then
                    hum:ChangeState(Enum.HumanoidStateType.Landed)
                end
            end)
        end
    end
end
1 Like

Unfortunately, it stills giving me the same result. Legs/arms are misplaced while walking or idle, and walk animations is playing on idle. (My walking animations priority are set to movement, and loop is on)

1 Like

Can you try this code? I added debugs to it.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:FindFirstChildOfClass("Humanoid")

if hum and character:FindFirstChild("Animate") then
    print("Animate script found. Setting up animation tracking.")
    
    for _, anim in ipairs(character.Animate:GetDescendants()) do
        if anim:IsA("Animation") then
            print("Tracking animation:", anim.AnimationId)
            
            anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
                print("AnimationId changed:", anim.AnimationId)
                
                if hum:GetState() == Enum.HumanoidStateType.Freefall or hum:GetState() == Enum.HumanoidStateType.Jumping then
                    print("Humanoid is in the air. Forcing Landed state.")
                    hum:ChangeState(Enum.HumanoidStateType.Landed)
                else
                    print("Humanoid is not in the air. No state change.")
                end
            end)
        end
    end
end

Animations aren’t update while active, maybe you want to add changestate on false condition. And still giving me the same result.

Also, I want to know if the problem occurs depend on what side (server/client) is running. I change player walk/idle animationid from server sided.

I am currently busy a little I will get back at you when I can. Also a theory maybe it happens because it can’t detect the player

1 Like

Client-Side Debug Script
This runs on the client (LocalScript in StarterCharacterScripts):

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:FindFirstChildOfClass("Humanoid")

if hum and character:FindFirstChild("Animate") then
    print("Client: Animate script detected.")

    for _, anim in ipairs(character.Animate:GetDescendants()) do
        if anim:IsA("Animation") then
            print("Client: Tracking animation:", anim.AnimationId)

            anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
                print("Client: AnimationId changed:", anim.AnimationId)

                if hum:GetState() == Enum.HumanoidStateType.Freefall or hum:GetState() == Enum.HumanoidStateType.Jumping then
                    print("Client: In air, forcing Landed state.")
                    hum:ChangeState(Enum.HumanoidStateType.Landed)
                else
                    print("Client: On ground, forcing Running state.")
                    hum:ChangeState(Enum.HumanoidStateType.Running)
                end
            end)
        end
    end
end

Server-Side Debug Script
Run this on the server (Script inside ServerScriptService):

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local hum = character:FindFirstChildOfClass("Humanoid")
        local animateScript = character:FindFirstChild("Animate")

        if hum and animateScript then
            print("Server: Animate script found. Modifying animations.")

            for _, anim in ipairs(animateScript:GetDescendants()) do
                if anim:IsA("Animation") then
                    print("Server: Tracking animation:", anim.AnimationId)

                    anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
                        print("Server: AnimationId changed:", anim.AnimationId)
                    end)
                end
            end
        end
    end)
end)

Let me know if anything happens

The animation doesn’t update on active. And also the same result.

There might be another script that is causing the move animation to loop on idle. Can you give me like a move’s script? If it’s loops on idle when done u might have to do like add a string to the player’s character named active and make a code for it. When a move is completed it will turn off the active but when a move is active it will turn the value of it to enabled and etc.

I don’t have a move script of what you said. Just only changing animationid from server and the update animation script from StarterCharacterScript. From what I’m thinking is when animationid changes while animation is active, player might play them on loop and causes animation to bug, i guess? (This happened on other clients and on the server aswell)

Also, I wanna know if tool and tool’s motor6D affect the animation. All my animations are set normally.

(Sorry for late reply, I was sleeping.)