ViewportFrame rig animation

hello, i’ve been trying to make a rig in a viewport play an animation, but it doesn’t work. does anybody know why it doesn’t play?

module.LoadEmotes = function(Player)
	local Slots = {
		["Slot1"] = Player.EquippedEmotes.Slot1.Value,
		["Slot2"] = Player.EquippedEmotes.Slot2.Value,
		["Slot3"] = Player.EquippedEmotes.Slot3.Value,
		["Slot4"] = Player.EquippedEmotes.Slot4.Value,
	}

	for _, Frame in pairs(Player.PlayerGui.emotes.Frame:GetChildren()) do
		if Frame:IsA("Frame") then
			local Slot = Slots[Frame.Name]

			if Slot and Slot ~= "" then
				Frame.TextLabel.Text = Slot
				local Animation = Services.ReplicatedStorage.Templates.Emotes:FindFirstChild(Slot)
				if Animation then
					local Rig = Frame.ViewportFrame:FindFirstChild("Rig")
					if Rig then
						local Humanoid = Rig:FindFirstChildWhichIsA("Humanoid")
						if Humanoid then
							local HumanoidAnimation = Humanoid:LoadAnimation(Animation)
							HumanoidAnimation:Play()
						end
					end
				end
			end
		end
	end
end

Sadly, ViewportFrames don’t support Humanoid animations. However, you can put your character in a WorldModel to make animations work.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.