How To Stop Animations On/From The Server

  1. What do I want to achieve?

I want to stop animations that both originated and were played from the Server.

  1. What is the issue?

I made a post last week that explains this in more detail, but I did not want to necro it, so I figured I would just ask a simpler version of the question.

Basically, on a Server-Script, I create and play animations for the player. The animations play for whoever triggers a ProximityPrompt, at least, that is the idea. There is a video example in the post linked above if you want to see the issue in that form. Basically, whenever I call the :Stop() method (from the Server), the animations are not stopping.

I believe this is because I am calling it from the Server and not the client, but I have found no luck in fixing the problem even when using the client to stop the animations. Here is the code.

A Server-Sided ModuleScript:

function Tree:gatherResource(player, humanoid, activityClone, tool, walkPart, lookPart, prompt)
	-- Disable the proximity prompt
	prompt.Enabled = false
	
	-- Tools
	local axe						= tool.Handle
	local axePosition				= axe.Position
	local axeOrientation			= axe.Orientation
	local axeCFrame					= CFrame.new(axePosition) * CFrame.Angles(math.rad(axeOrientation.X), math.rad(axeOrientation.Y), math.rad(axeOrientation.Z))

	-- SFX
	local axeHit = axe.Parent.Chop; axeHit.Looped	= false
	
	-- Move the humanoid
	movementEvent:FireClient(player, true)
	moveHumanoid(humanoid, walkPart, lookPart)
	
	-- Implement the logic for gathering wood here
	local pickUpAxe = humanoid:LoadAnimation(animationInstances.pickUpAxe)
	local positionAxe = humanoid:LoadAnimation(animationInstances.positionAxe)
	local chopWood = humanoid:LoadAnimation(animationInstances.chopWood)
	
	--Pick up the axe
	pickUpAxe:Play()
	pickUpAxe.Looped = false
	pickUpAxe:GetMarkerReachedSignal("PickUpAxe"):Connect(function()
		axe.Anchored = false
		axe.Parent.Parent = player.Character
		axe.CanCollide = false
	end)
	pickUpAxe.Stopped:Wait()
	
	--Position the axe
	positionAxe:Play()
	positionAxe.Looped = false
	positionAxe.Stopped:Wait()
	
	-- Chop wood
	chopWood:Play()
	chopWood:GetMarkerReachedSignal("AxeSound"):Connect(function()
		axeHit:Play()
	end)
	
	endHarvestEvent.OnServerEvent:Connect(function(player)
		
		if pickUpAxe.IsPlaying or positionAxe.IsPlaying or chopWood.IsPlaying then
			print("The animations are playing")
			pickUpAxe:Stop(.5)
			positionAxe:Stop(.5)
			chopWood:Stop(.5)
			
			--endAnimationEvent:FireClient(player)
		end
		
		
		
		tool.Parent = activityClone
		tool:PivotTo(axeCFrame)
		axe.Anchored = true
		axe.CanCollide = true
		
		if player.PlayerGui.ScreenGui:FindFirstChild("InstructionText") then
			local textLabel = player.PlayerGui.ScreenGui:FindFirstChild("InstructionText")
			local Tween = TS:Create(textLabel, tweenInfo1, {TextTransparency = 1})
			Tween:Play()
			task.wait(1)
			textLabel:Destroy()
		else
			
		end
		
		task.wait(.1)
		prompt.Enabled = true
		
	end)
	
end

And here is the code inside a Client-Side ModuleScript that is responsible for triggering the remote event that is supposed to stop the animations.

function Movement.Start(state : boolean)
	local function handleAction(actionName, inputState, inputObject)
		if actionName == "StopW" or actionName == "StopS" or actionName == "StopA" or actionName == "StopD" or actionName == "StopSpace" then
			if inputState == Enum.UserInputState.Begin then

			else

			end
		elseif actionName == "StopE" then
			if inputState == Enum.UserInputState.Begin then
				if not Movement.debounceVar then
					Movement.debounceVar = not Movement.debounceVar
					endHarvestEvent:FireServer()
					task.wait(1)
					Movement.Start(false)
					Movement.debounceVar = not Movement.debounceVar
				else
					print("debounce active, please wait!")
				end
			end
		end

	end
	
	if state == true then
		CAS:BindAction("StopW", handleAction, true, Enum.KeyCode.W)
		CAS:BindAction("StopS", handleAction, true, Enum.KeyCode.S)
		CAS:BindAction("StopA", handleAction, true, Enum.KeyCode.A)
		CAS:BindAction("StopD", handleAction, true, Enum.KeyCode.D)
		CAS:BindAction("StopSpace", handleAction, true, Enum.KeyCode.Space)
		CAS:BindAction("StopE", handleAction, true, Enum.KeyCode.E)
	else
		CAS:UnbindAction("StopW")
		CAS:UnbindAction("StopS")
		CAS:UnbindAction("StopA")
		CAS:UnbindAction("StopD")
		CAS:UnbindAction("StopSpace")
		CAS:UnbindAction("StopE")
	end
	
end

movementEvent.OnClientEvent:Connect(function(state)
	Movement.Start(state)
end)
  1. What solutions have I tried thus far?

Considering the fact that I have been trying to solve this for a while, I have tried many things. I have re-configured the ServerScript, tried moving all the logic for stopping animations onto the client via a remote event, but this did not work. I am unsure how to properly send the animations to stop from the Server onto the client, and when I tried to just load the animations manually on the client and then stop them there, it did not work as well.

As I said before, there is more information on the hyperlinked post, but any help is appreciated. Thanks in advance.