Animation isn't working

I’m trying to make an effect where when you run into a log, you trip. I made a falling animation and made a script that makes it play when you hit a log but it’s not working. The animation just doesn’t play, even though it’s definitely the currect Id.

Here’s the script:

print("Hello") -- it prints
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local Player = game.Players:GetPlayerFromCharacter(hit.Parent)

I have no idea why this doesn’t work, there were no errors in the output.

Maybe try:

local Hits = {}
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
    if Hits[player.UserId] then return end
    Hits[player.UserId] = true
    local Animation =  Player.Character.Humanoid:LoadAnimation(Player.Character.Animation)
    Animation.AnimationPriority = Enum.AnimationPriority.Action -- Ideally you should set this in the Animation Editor because it won't replicate otherwise.
       Hits[player.UserId] = nil

You may want to also stop the player from moving when tripped too, but it’s up to you.

Thanks so much! I just realized it’s because I didn’t set it to action. I misread your post , sorry about that reply.