PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetAnimations

This function returns an InventoryPages object which can be used to iterate over animations owned by a specific user.

This function has a number of potential uses, such as allowing users to browse and import animations into a custom animation plugin.

Parameters

Name Type Default Description

The user ID of the user.

Returns

Return Type Summary

An InventoryPages of animations.


Code Samples


KeyframeSequenceProvider GetAnimations

This code sample includes a demonstration of how the content IDs of animations belonging to a player can be downloaded using KeyframeSequenceProvider/GetAnimations. To run this code be sure to change the USER_ID variable to the ID of the user whose animations you want to download.

local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")

local USER_ID = 0 -- Insert your UserId here

local function extractPages(pagesObject)
    local array = {}
    while true do 
        local thisPage = pagesObject:GetCurrentPage()
        for _, v in pairs(thisPage) do 
            table.insert(array, v)
        end
        if pagesObject.IsFinished then
            break 
        end 
        pagesObject:AdvanceToNextPageAsync()
    end
    return array
end

local inventoryPages = KeyframeSequenceProvider:GetAnimations(USER_ID)

local animationIds = extractPages(inventoryPages)

for _, id in pairs(animationIds) do 
    print(id)
end
print("total: ", #animationIds)