Is it possible to stop animation playing from the client, with the server?

Dear Devforum,

I noticed that Roblox auto replicates animation from the client to the server. So is it possible that your able to stop the replicated animation?

Example:

My Animation Based Hitboxes problem.

Player does combat animation in client, their combo reaches, let’s say 4. Their in cooldown so server sets them in cooldown, the cooldown would stop the player. But player is still able to play animation even in cooldown, which ruins the point of an cooldown.

I don’t want my hitboxes and animation to be in the server because their less responsive, increase server work load, and delayed (apparently).

From: Murt (Beginner Scripter)

You could always get players Animator and use the GetPlayingAnimationTracks method to get the playing tracks so you could stop them.

Why don’t you set a value or attribute under the player indicating if they’re on the cooldown? With this you could always read the value and if it’s false you play the animation.

1 Like

Like this?

function stopAnimation(Animator:Animator)
	for _, animTrack in pairs(Animator:GetPlayingAnimationTracks()) do
		if animTrack.Animation.Parent == game.ReplicatedStorage.animFolder then
			animTrack:Stop()
		end
	end
end

For stopping animation part? I didn’t really understand the documentation about it.

I think he means setting an attribute in the player like…

--assuming you have the player variable
player:SetAttribute("animationState", false) --will set the state (false = stopped)

--you can then on the client
player:GetAttributeChangedSignal("animationState"):Connect(function()
--if animationState == false then stop the animation
end)

Something like this?

Yes that’s what I was talking about in the first part

For the other part, I was saying you could create an attribute indicating if the player is on cooldown or not from the server. To prevent the client from playing the animation, you would just check if this attribute exists and if its true