So I have an animation that holds out the player hand so it can form something but the animation plays once then as soon as I start walking it stops. I am running the animation from a local script in the starter pack. Please tell me how t fix this. Extra info: Yes the animation is looped I have checked a lot and the animation priority is set to Action.

Local script:

local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local Debounce = false
local remoteEvent = game.ReplicatedStorage:WaitForChild("Start")
local holdanim = Instance.new("Animation")
holdanim.AnimationId = "rbxassetid://5099286375"

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.R and not Debounce then
		
		local track = player.Character.Humanoid:LoadAnimation(holdanim)
		track:Play()
		
		player.Character.UpperTorso.Anchored = true
		player.Character.Humanoid.WalkSpeed = 0
		
		remoteEvent:FireServer()
		
		wait(1)
		
		player.Character.UpperTorso.Anchored = false
		player.Character.Humanoid.WalkSpeed = 16
		
	end
end)