Animations not playing on Model in a viewportFrame

Hello,

I’m trying to add a feature in my game that at the end of the round, it shows the winner’s character doing a dance in a viewportFrame. The cloth loading works properly, but for some reason, the dance animation doesn’t play.

local viewportFrame = script.Parent.ViewportFrame

local len = viewportFrame.AbsoluteSize.X/2

local DumDum = script.Check1:Clone()

DumDum.PrimaryPart = DumDum.HumanoidRootPart

DumDum.Parent = viewportFrame.world

The following is another part of the script:

local Dance = GetCloth:InvokeServer('Dance','player_' .. pleyer.UserId) or 'rbxassetid://6129637854'
local DumHum = DumDum.Humanoid
local danceAnimation = Instance.new("Animation")
danceAnimation.AnimationId = Dance
local danceAnimationTrack = DumHum:LoadAnimation(danceAnimation)
danceAnimationTrack:Play()

I heard that Humanoid:LoadAnimation() was deprecated, so I replaced it with an ‘Animator’ and it still didn’t work. I tried putting the dummy in a world in the viewportFrame, but after that only the head and lowertorso animations play. I am certain that the animations are published correctly and the ids are right, as it partially works when I put it in a ‘worldModel’

Does anyone know why this doesn’t work properly?
Thanks,

1 Like

You cant play animation in viewport frame so you need have dummy in workspace and play animation at him and clone him every frame and paste in viewport frame after deleting previous frame dummy in viewport frame.
Idk about Humanoid:LoadAnimation was deprecated bec I using him always and alright

Try using WorldModel. It will allow you to play animation inside of GUI.

1 Like

I did already. Turns out the problem was with my Dummy. When I made a new it worked fine.

The problem was with my Dummy, everything worked but The Model I used was really weird. I made a new one and that fixed it

1 Like