Confusing behavior of animation priority

Hello. I have not touched character animations for a long time and I came back to it. I am very confused and I need help. I could not find answer to my problem anywhere.

I made an animation, where a player character should hold out hands for electric zap special ability. I set the priority of this animation to Action. The animation works as intended but only when I am standing and not moving. However when I try moving the character while holding hands like that, even if running animation has an animation priority of Core, both of these animations merge. I would except this behavior only if these animations had the same priority but it is not like that.

Here is a video showing my problem and my script. Any help is appreciated. Thank you for attention.

local contextActionService, userInputService = game:GetService("ContextActionService"), game:GetService("UserInputService")
local workstation = workspace

local abilitiesSet = script.Parent
local sendElectricZapSignal = abilitiesSet:WaitForChild("SendElectricZapSignal")
local currentCamera = workstation.CurrentCamera
local zapParts = workstation:WaitForChild("ZapParts")

local character = abilitiesSet.Parent
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local zapStartTrack = animator:LoadAnimation(abilitiesSet:WaitForChild("ZapStart"))
local zapActualTrack = animator:LoadAnimation(abilitiesSet:WaitForChild("ZapActual"))

local customRaycastParams = RaycastParams.new()
local begin = Enum.UserInputState.Begin
local mouseLocation, screenToWorldRay, raycastResult

customRaycastParams.FilterType = Enum.RaycastFilterType.Exclude
zapActualTrack:AdjustSpeed(1.5)
zapActualTrack.Looped = true

contextActionService:BindAction("Use Electric Zap", function(actionName, inputState, inputObject)
	if inputState == begin then
		customRaycastParams.FilterDescendantsInstances = zapParts:GetChildren()
		mouseLocation = userInputService:GetMouseLocation()
		screenToWorldRay = currentCamera:ViewportPointToRay(mouseLocation.X, mouseLocation.Y)
		raycastResult = workstation:Raycast(screenToWorldRay.Origin, screenToWorldRay.Direction * 256, customRaycastParams)
		zapStartTrack:Play()
		zapStartTrack:GetMarkerReachedSignal("TheStop"):Wait()
		zapStartTrack:Stop()
		zapActualTrack:Play()
	else
		zapActualTrack:Stop()
	end
	sendElectricZapSignal:FireServer(inputState == begin)
end, false, Enum.KeyCode.Z)
1 Like

Hello. I figured this out. I did not animate all parts of the limb so I added empty keyframes to all parts of the upper limbs.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.