Skinned mesh wont play animation with script

When I run the game my skinned mesh wont play my animation:

local animation = Instance.new("Animation")

animation.AnimationId = "rbxassetid://10770180914"

animation.Parent = script.Parent

local animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

-- Load animation onto the animator

local AnimationTrack = animator:LoadAnimation(animation)

AnimationTrack:Play()

print("Played")

it prints played but doesnt play the animation

Maybe try this

wait()
local animation = Instance.new("Animation")

animation.AnimationId = "rbxassetid://10770180914"

animation.Parent = script.Parent

local animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

-- Load animation onto the animator

local AnimationTrack = animator:LoadAnimation(animation)

AnimationTrack:Play()

print("Played")

it still didnt work. i dont know why

Maybe try doing this

wait()

local animation = script.Animation

animation.AnimationId = "rbxassetid://10770180914"

local animator = script.Parent.Humanoid.Animator

-- Load animation onto the animator

local AnimationTrack = animator:LoadAnimation(animation)

AnimationTrack:Play()

print("Played")

image