Can't I animate character in ViewportFrame?

I’m creating a store in-game where player can select the character and check it in 3D. I’ve created a ViewportFrame inside Screen Gui and trying to load some basic animations and unable to do so.

I did tried same script on same model in workspace and it works fine, but not in ViewportFrame.

here is the script.

wait(5)

local mainFrame = script.Parent
local viewportFrame = mainFrame.ViewportFrame
local model = viewportFrame:FindFirstChild("Burger")
local humanoid = model:FindFirstChild("Humanoid")
local idealAnimation = model:FindFirstChild("Ideal") -- This is animation

local player = humanoid:LoadAnimation(idealAnimation)
print(player)
player:Play()

-- Here I'm applying same animation on same model in Workspace
local workspaceModel = workspace.Burger
local wHumanoid = workspaceModel.Humanoid
local wPlayer = wHumanoid:LoadAnimation(idealAnimation)
wPlayer:Play()
1 Like

The ViewportFrame has to have a WorldModel object as a descendant, which the character is then a descendant of. Otherwise it will not work.

2 Likes

I did what you said, but still not working.
Capture

Okay my bad, for testing purpose, I added Animation Controller to replace Humanoid and then I forgot to remove it. Now it’s working while following your trick.

Can you tell me where it is written to have World Model for Animations to work in ViewportFrame?

1 Like