Temporarily Stop all Player Animations For Duration of Punch Animation

so basically i have some combat code and i want to make it balanced, so that while a player is sliding or rolling, when they punch, the animation shows.

however, right now, only the slide animation shows, and there is no sign of the punch animation, however other players will still take damage from the punch. (this is obviously unbalanced)

so I wanted to know if there was a way of temporarily stopping player animations as long as the punch animation is playing, and then resuming the animations at however many seconds into the animation it was earlier, as using this method:


which i found earlier completely stops all animations and does not resume them when my punch animation is done.

this is my code, by the way:
(localscript in starterpack)

local plr = game.Players.LocalPlayer
local A1 = plr.Character.Humanoid:LoadAnimation(script.A1)
local A2 = plr.Character.Humanoid:LoadAnimation(script.A2)
local A3 = plr.Character.Humanoid:LoadAnimation(script.A3)

local animator = plr.Character.Humanoid:FindFirstChildOfClass("Animator")


local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(Input, IS)
	if IS == true then return end
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		if debounce == true then return end
		debounce = true
		for i,v in ipairs(animator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		A1:Play()
		task.wait(0.2)
		game.ReplicatedStorage.CombatHit:FireServer()
		print("E pressed")
		task.wait(3)
		debounce = false
	end
end)

re upload your punch animation and change the animation priority:
image
image

core had the least priority while action 4 has the highest. set the punch higher than the slide

I was thinking of doing this but there’s quite a few animations, so do you know if there’s anyway that might take less time?

if its too much you can do it by code like this:

track.Priority= Enum.AnimationPriority.Action

but i dont think there is any other way sorry

1 Like