Animation doesn't start playing!

I’m trying to make a movement animations script. But the animation won’t play. The humanoid is walking but not playing the animation. (not player character)
Here’s my script:

-- variables
local Humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local track

-- tables
local animations = {
    [Enum.HumanoidStateType.None] = {
        ["Speed"] = 1;
        ["Animation"] = script.Idle;
    };
    [Enum.HumanoidStateType.Running] = {
        ["Speed"] = 1.5;
        ["Animation"] = script.Running;
    };
}

-- functions
function onStateChanged(state)
    
    local anim
    
    if animations[state] then
        anim = animations[state]
    else
        return
    end
    
    if track then
        track:Stop()
    end
    
    track = Humanoid:LoadAnimation(anim.Animation)
    
    track.Priority = Enum.AnimationPriority.Action
    track.Looped = true
    
    track:AdjustSpeed(anim.Speed)
    
end

-- triggers
Humanoid.StateChanged:Connect(onStateChanged)

All the animation are retreived successfully from the table but it’s just not working!
Help appreciated! :slight_smile:

There’s no errors.

you have to play the animation by using :Play()

HOW STUPID AM I?!
xD I’ll try it!

It now works, but the collissions aren’t working properly.

What do you mean by “the collisions aren’t working properly”?