Animation priority is not working correctly

I set the animation priority above core to fix overlapping but it didn’t work the animations are still being overlapped

Script:

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Animator = Character.Humanoid:WaitForChild("Animator")
local StartAimingAnimationthing = script:WaitForChild("Start Aiming")
local AimingLoopAnimationthing = script:WaitForChild("Aiming Loop")
local AimingLoop = Animator:LoadAnimation(AimingLoopAnimationthing)
local StartAiming = Animator:LoadAnimation(StartAimingAnimationthing)
local UserInputService = game:GetService("UserInputService")
local Isholding = false


local function onInputBegan(input, _gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		Isholding = true
		StartAiming:Play()
		task.wait(StartAiming.Length)
		if Isholding == true then
			AimingLoop:Play()
		end	
	end
end

local function onInputEnded(input, _gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		Isholding = false
		StartAiming:Stop()
		AimingLoop:Stop()
	end
end

UserInputService.InputBegan:Connect(onInputBegan)
UserInputService.InputEnded:Connect(onInputEnded)

Extra information: The character I’m trying to animation is a startercharacter and it doesn’t have a animate local script in it

1 Like

maybe try to manually set animation priority to Action2 (Override Action and anything below) to ensure the priority is correct

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Animator = Character.Humanoid:WaitForChild("Animator")
local StartAimingAnimationthing = script:WaitForChild("Start Aiming")
local AimingLoopAnimationthing = script:WaitForChild("Aiming Loop")
local AimingLoop = Animator:LoadAnimation(AimingLoopAnimationthing)
local StartAiming = Animator:LoadAnimation(StartAimingAnimationthing)
local UserInputService = game:GetService("UserInputService")
local Isholding = false


local function onInputBegan(input, _gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		Isholding = true
		StartAiming:Play()
        StartAiming.Priority = Enum.AnimationPriority.Action
		task.wait(StartAiming.Length)
		if Isholding == true then
			AimingLoop:Play()
            AimingLoop.Priority = Enum.AnimationPriority.Action2
		end	
	end
end

local function onInputEnded(input, _gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		Isholding = false
		StartAiming:Stop()
		AimingLoop:Stop()
	end
end

UserInputService.InputBegan:Connect(onInputBegan)
UserInputService.InputEnded:Connect(onInputEnded)

Oh I’m sorry I forgot to toggle this post solved when I figured out the issue by-myself!

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