adicione a funçao de definir a prioridade nas animaçoes para action : -- Welcome to Animify V2

--[[

	Version: 2.4
	Documentation and API Link: https://devforum.roblox.com/t/2462029
	
	Credits: Programmed by @4vials, designed by @ParadoxAssets
	Contributors: @SaintImmor, @Bloxmaster998144
--]]

local Controller = setmetatable({}, {
	__index = require(script:WaitForChild('Configuration'))
})

local Sections = {} -- cache to destroy when refreshing


-- UI Components
local AnimationGUI = script.Parent
local AnimationFrame = AnimationGUI:WaitForChild('MainFrame')
local ToggleButton = AnimationGUI:WaitForChild('toggle')

-- Dependencies
local Assets = script:WaitForChild('Assets')
local Player = game.Players.LocalPlayer

-- Animation Modules
local SectionsFolder = script:WaitForChild('Sections')
local Utility = require(script.Utility)


-- Controller variables
Controller.Frame = AnimationFrame
Controller.Enabled = false

-- Internal Variables
local PlayingAnimation = nil
local CharacterInformation = game:GetService('Players'):GetHumanoidDescriptionFromUserId(Player.UserId)

-- Constants
local Positions = {
	Open = UDim2.new(.5, 0, .5, 0),
	Closed = UDim2.new(.5, 0, 1.5, 0)
}

-- Funcs
local tween = Utility.Tween

local function AddSection(sectionName: string)
	if Sections[sectionName] then
		warn(sectionName..' already exists')
		return
	end
	
	local sectionButton = Assets.SectionButton:Clone()
	sectionButton.Parent = AnimationFrame.Sections
	sectionButton.Text = sectionName
	
	Utility.SetupSectionButton(sectionButton, sectionName)
	
	
	Sections[sectionName] = {sectionButton}
	
	return Sections[sectionName]
end

local function AddAnimation(sectionName: string, animationTitle: string, animationID: number)
	task.defer(function()
		local section = Sections[sectionName] or AddSection(sectionName)

		local newButton = Assets.AnimationButton:Clone()
		newButton.Parent = AnimationFrame.Content.ScrollingFrame
		newButton.Label.Text = animationTitle
		newButton:SetAttribute('Section', sectionName)

		local animation = Instance.new('Animation')
		animation.Parent = newButton.WorldModel
		animation.AnimationId = 'rbxassetid://'..animationID

		local avatar = nil

		if Controller.UsePlayerCharacter then
			-- Note, if the animation is R15 but your player character is R6, it wont work. Change your avatar type in Game settings.
			local character = Player.Character or Player.CharacterAdded:Wait()

			if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
				avatar = Assets.TemplateR15:Clone()
			elseif character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
				avatar = Assets.TemplateR6:Clone()
			else
				warn('Invalid player character type, could not load animation')
				return
			end
			
			-- incase the template has shirt or pants, we have to remove them or else ApplyDescription wont work
			local shirt, pants = avatar:FindFirstChildOfClass('Shirt'), avatar:FindFirstChild('Pants')
			if shirt then
				shirt:Destroy()
			end
			if pants then
				pants:Destroy()
			end

			avatar.Parent = newButton.WorldModel -- we need to parent it for the ApplyDescription function to work
			avatar.Humanoid:ApplyDescription(CharacterInformation)
		else
			if Controller.DefaultAvatarType == 'R15' then
				avatar = Assets.TemplateR15:Clone()
			elseif Controller.DefaultAvatarType == 'R6' then
				avatar = Assets.TemplateR6:Clone()
			else
				-- must be either "R6" or "R15", R capital.
				warn('Invalid AnimationType, only "R6" and "R15" are supported currently set to: ', Controller.DefaultAvatarType)
				return
			end
		end

		avatar.Parent = newButton.WorldModel

		task.wait()
		local loaded = avatar:WaitForChild('Humanoid').Animator:LoadAnimation(animation)
		loaded.Looped = true
		loaded:Play()

		local Camera = Instance.new("Camera")
		Camera.Parent = newButton.WorldModel
		Camera.Name = "CurrentCamera"
		Camera.CFrame = CFrame.lookAt((avatar.HumanoidRootPart.CFrame * CFrame.new(0,0,-math.abs(Controller.ViewDistance))).p, avatar.HumanoidRootPart.Position)
		newButton.CurrentCamera = Camera

		newButton.TextButton.Activated:Connect(function()
			Utility.SetRunningAnimation(newButton)

			if Controller.HideUiOnSelect then
				-- hide the ui 
				Controller.CloseGui()
			end
		end)

		Utility.SetupNewButton(newButton)

		table.insert(section, newButton)
	end)
end


-- Controller.AddAnimation() 
function Controller.AddAnimation(sectionName: string, animationTitle: string, animationID: number)
	if type(animationID) ~= "number" then
		if type(animationID) == 'string' then
			if string.find(animationID, 'rbxassetid://') then
				animationID = tonumber(string.split(animationID, '://')[2])
			end
		end
	end
	if not sectionName or not animationTitle or not animationID then
		warn(('Controller.AddAnimation() Missing Argument %s'):format((not sectionName and '"sectionName"')) or (not animationTitle and '"animationTitle"') or '"animationID"')
		return
	end
	AddAnimation(sectionName, animationTitle, animationID)
end


-- Controller.Refresh()
function Controller.Refresh()
	for _, section in pairs(Sections) do		
		for _, button in pairs(section) do
			button:Destroy()
		end
	end
	table.clear(Sections)
	for _, section in pairs(SectionsFolder:GetChildren()) do
		local section_name = section.Name
		AddSection(section_name)
		
		for anim, id in pairs(require(section)) do
			Controller.AddAnimation(section_name, anim, id)
			task.wait()
		end
	end
end

-- Controller.ToggleState()
function Controller.ToggleState()
	Controller.Enabled = not Controller.Enabled
	if not Controller.Enabled then
		tween(AnimationFrame, 'Position', Positions.Closed, 0.5)
		Utility.DisableToggleButton()
	else
		tween(AnimationFrame, 'Position', Positions.Open, 0.5, Enum.EasingStyle.Back)
		Utility.EnableToggleButton()
	end
end

ToggleButton.TextButton.MouseButton1Down:Connect(Controller.ToggleState)

-- Controller.CloseGui()
function Controller.CloseGui()
	tween(AnimationFrame, 'Position', Positions.Closed, 0.5)
	Utility.DisableToggleButton()
end

-- Controller.OpenGui()
function Controller.OpenGui()
	tween(AnimationFrame, 'Position', Positions.Open, 0.5, Enum.EasingStyle.Back)
	Utility.EnableToggleButton()
end

-- Controller.DisableToggle()
function Controller.DisableToggle()
	ToggleButton.Visible = false
	Utility.DisableToggleButton()
end

-- Controller.EnableToggle()
function Controller.EnableToggle()
	ToggleButton.Visible = true
end


-- last
Utility.SetupSectionButton(AnimationFrame.Sections.All, nil)


-- Apply global settings
if Controller.SectionsEnabled then
	AnimationFrame.Sections.Visible = true
else
	AnimationFrame.Sections.Visible = false
end

if Controller.KeyBind then
	if typeof(Controller.KeyBind) ~= 'EnumItem' then
		warn('Invalid keybind, must be an Enum.KeyCode')
	else
		game:GetService('UserInputService').InputBegan:Connect(function(inputObject, gameProcessedEvent)
			if gameProcessedEvent then
				return
			end
			if inputObject.KeyCode == Controller.KeyBind then
				Controller.ToggleState()
			end
		end)
	end
end

if Controller.ToggleButton then
	Controller.EnableToggle()
else
	Controller.DisableToggle()
end

if Controller.LoadOnRequire then
	Controller.Refresh()
end


return Controller