Why is my animations not playing in viewport frames?

I am attempting to play an NPC’s animation in viewport frames. The viewport is rendering the NPC fine and the text is being typed out correctly but for some reason tha animation is not playing. I also get no error at all.

            delayTime = 0.05;
            extraDelayOnSpace = true;

        local tween = TweenService:Create(TutorialUI.Main, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut, 0, false, 0), {Position = UDim2.new(0,0,0,0)})

        local WaveAnimation = Instance.new("Animation")
        WaveAnimation.AnimationId = "http://www.roblox.com/asset/?id=507770239"
        local IdleAnimation = Instance.new("Animation")
        IdleAnimation.AnimationId = "http://www.roblox.com/asset/?id=507766388"

        local Camera = Instance.new("Camera")
        Camera.Parent = TutorialUI.Main.NPCViewport
        Camera.CFrame = CFrame.new(workspace.TutorialCameraView.Position, workspace.NPCs.PilotDan.Head.Position)

        TutorialUI.Main.NPCViewport.CurrentCamera = Camera
        workspace.NPCs.PilotDan.Parent = TutorialUI.Main.NPCViewport

        local WaveAnimTrack = TutorialUI.Main.NPCViewport.PilotDan.Humanoid:LoadAnimation(WaveAnimation)
        WaveAnimTrack.Looped = false

        local IdleAnimTrack = TutorialUI.Main.NPCViewport.PilotDan.Humanoid:LoadAnimation(IdleAnimation)
        IdleAnimTrack.Looped = true

        local Stage1 = coroutine.wrap(function()
            TypeWriter.typeWrite(TutorialUI.Main.DialogueText, "Hello, "..Player.Name.."! Welcome to the Henverse! My name is Pilot Dan and I have been told your new around here so let me get you up to speed.")

1 Like

Do you have a WorldModel in your ViewportFrame, and your stuff that needs to be animated, in that WorldModel?


Animations, and a large amount of other things, can’t function inside of ViewPortFrames. Thankfully, roblox introduced WorldModels, a while back, which allows for joints to load( making animations possible ),when placed inside of a ViewPortFrame.