Idle Animtion not stopping

I’m working on a fist combat system and I’ve run into a roadblock for the blocking system(heh) where pressing q will play the animation but lifting q won’t stop it. It’s not a problem with the client side as it can print “yes” going up and down, and the server is fine as you can’t punch while holding q but after releasing you can. Help.

Server:

elseif action == "Block" then
		local track = player.Character.Humanoid:LoadAnimation(script.Block.BlockIdle)
		
		if block == true then
			track:Play()
			
		elseif block == false then
			track:Stop()
		end
	end
end)

Client:

UIS.InputBegan:Connect(function(input, processed)
	if processed then return end

	if input.KeyCode == Enum.KeyCode.Q then
		game.ReplicatedStorage.Events.CombatEvent:FireServer(combo, "Block", true)
		block = true
	end
end)

UIS.InputEnded:Connect(function(input, processed)
	if processed then return end

	if input.KeyCode == Enum.KeyCode.Q then
		game.ReplicatedStorage.Events.CombatEvent:FireServer(combo, "Block", false)
		block = false
	end
end)

You should actually try to play these animations locally instead of server-sided. Since clients own their character (physics-wise) animations are able to replicate automatically without having the need for the server to play them.

It might not be stopping due to the input delay it takes to communicate to the server, and might also be unexpected behavior with playing the animations server-sided rather than locally.

So would i fire all clients to see the animation?

You don’t even need to use remote events, just handle playing/stopping animations directly from your LocalScript.

But wouldn’t that make it so only the person who is blocking can see the animation?

Nope. Animations are an exception to the whole client-server thing. Animations played on the client’s own character will be visible for other players to see.

Oh, I didn’t know that. Thanks.

1 Like