Animation priority is != (lower) than its KeyframeSequence priority

I know the title is extremely confusing, but allow me to elaborate;

i have a KeyframeSequence stored inside server storage, and its priority is Action4:

however, when loading in the animations during testing, their priorities are set back to Action
i tested this a bit, and this only happens with my attack animations
image
image

(Heavy is an attack animation; Base is a chase animation)

sure, a simple fix would be to just do track.Priority = Enum.AnimationPriority.Action4, but i actually want to find the culprit of the issue here

i’m not exactly able to pinpoint any issues in my code, since all it does is just roll an animation, and play it:

-- // MODULE \\ --
function utility.RNG(tableOfChances: {Instance: {number}})
	local totalChance = 0

	for _,chance in tableOfChances do
		totalChance += chance
	end

	local rng = math.random(1, totalChance)

	for option,chance in tableOfChances do
		rng -= chance
		if rng <= 0 then return option end
	end
end

-- // SERVER-SIDE \\ --
local function GetEnemyComponents(enemy: Model)
	local animations: Folder = enemy:FindFirstChild("Animations")
	local attackAnimations: Folder = animations and animations:FindFirstChild("Attacks")
	local sounds: Folder = enemy.PrimaryPart:FindFirstChild("Sounds")
	local values: Folder = enemy:FindFirstChild("Values")
	return animations, attackAnimations, sounds, values
end

local function HandleMeleeCombat(enemy: Model, rootPart: BasePart, enemyData: {any})
	local enemyAnimations, attackAnimations, enemySounds, enemyValues = GetEnemyComponents(enemy)
	
	local detectors: Folder = enemy:FindFirstChild("Detectors")
	local combatDetector: BasePart = detectors:FindFirstChild("Combat")
	
	local playersInPart: {Player} = utility.GetPlayersInPart(combatDetector)
	if not playersInPart then return end

	local enemyHumanoid = enemy:FindFirstChildOfClass("Humanoid")
	if not enemyHumanoid then return end

	local comboTrack, heavyTrack = LoadEnemyAnimations(enemyHumanoid, attackAnimations)
	local animations = {
		[comboTrack] = 60,
		[heavyTrack] = 40
	}

-- these are unused functions that have no code in them, so i am not including them
	if PerformSpecialAttackIfReady(enemy, enemyValues, enemyData) then
		return
	end

	if specialsModule.DodgeOrShoveIfPossible(enemy) then
		return
	end
	
	local chosenTrack: AnimationTrack = utility.RNG(animations)
	print(`the priority of {chosenTrack.Name} is {chosenTrack.Priority}`)
	local markersToUse
	if string.find(chosenTrack.Name, "Heavy") then
		markersToUse = enemyData.heavyMarkers
	elseif string.find(chosenTrack.Name, "Combo") then
		markersToUse = enemyData.comboMarkers
	end

-- this is responsible for damage output, but since the animation never reaches any marker because it instantly stops, i am not including this function
	local markerConnection = SetupAttackMarkers(enemy, chosenTrack, markersToUse, rootPart)
	local combatValues: Folder = enemyValues.combatValues

	chosenTrack:Play()
	combatValues.attacking.Value = true
	
	--chosenTrack.Stopped:Once(function()
	--	markerConnection:Disconnect()
	--	combatValues.attacking.Value = false
	--	combatValues.attackCooldown.Value = true
	--	task.wait(enemyData.attackCooldown)
	--	combatValues.attackCooldown.Value = false
	--end)
end

my only theory is that this is a bug, and i have no other explanation

So I’m just going to ask you have uploaded the animationID with the correct priority? because changing a keyframesequences priority does nothing unless you upload it.

yes, yes i have

i uploaded it with the animation priority and have set the id

Can I see your loadanimation function? Starting to think this is more or less a roblox cache issue if it could be; have you tried testing it ingame? Not sure if that would fix anythin

oh i forgot to include that in my initial post, oops

local function LoadEnemyAnimations(enemyHumanoid: Humanoid, attackAnimations: Folder)
	local animator: Animator = enemyHumanoid:FindFirstChildOfClass("Animator") or enemyHumanoid.Parent:FindFirstChildOfClass("AnimationController"):FindFirstChild("Animator")
	local comboAnim: Animation = attackAnimations:FindFirstChild("Combo")
	local heavyAnim: Animation = attackAnimations:FindFirstChild("Heavy")

	local comboTrack: AnimationTrack = animator:LoadAnimation(comboAnim)
	local heavyTrack: AnimationTrack = animator:LoadAnimation(heavyAnim)

	return comboTrack, heavyTrack
end

ALSO;

i noticed that the abrupt animation stopping happens regardless of priority, my enemy Animate script is kinda interfering with it, so i disabled it for now (because i need to fix it)