Wierd char movment after anchoring and playing an animation then unanchoring

I’ve made a kick animation and I’ve made the HumanoidRootPart anchor when it play so the animation can play if the player char is in midair then unanchor the HumanoidRootPart after playing it. I tested if it was because something in my game so I try to create a new game with just a map and the ability Gui/kick Gui but it still didn’t work.

robloxapp-20201224-1501366.wmv (2.3 MB)

local script in a GUI

>    *local UserInputService = game:GetService("UserInputService")*
> 
>     *local player = game.Players.LocalPlayer*
> 
>     *local CanAttack = true*
> 
>     *UserInputService.InputBegan:Connect(function(input)*
> 
>     *local Equipped*
> 
>     local Animation = script.Parent.Animation
> 
>     local UltimateKick = player.Character:WaitForChild("Humanoid"):LoadAnimation(Animation)
> 
>     for i, v in pairs(player.Character:GetChildren()) do
> 
>     if v:IsA("Tool") then
> 
>     Equipped = true
> 
>     else
> 
>     Equipped = false
> 
>     end
> 
>     end
> 
>     if input.KeyCode == Enum.KeyCode.Q then
> 
>     if CanAttack == true and Equipped == false and player.Character.Humanoid.Jump == false then
> 
>     player.Character.HumanoidRootPart.Anchored = true
> 
>     CanAttack = false
> 
>     script.Parent.CanAttack.Value = true
> 
>     UltimateKick:Play()
> 
>     wait(UltimateKick.Length)
> 
>     player.Character.HumanoidRootPart.Anchored = false
> 
>     script.Parent.CanAttack.Value = false
> 
>     CanAttack = true
> 
>             end
>         end
>     end)

edit: something happen to the indentation so soz if it’s hard to read