function EmoteManager.updateEmotes(A,j,H)local M=A.playerOwnedEmotes[j.UserId]or{}local l=emotes.getValues()local L={}for j,H in pairs(l)do if defaultEmotes[j]and defaultEmotes[j].emote==H.emote then continue elseif paidEmotes[j]and paidEmotes[j].emote==H.emote then continue end L[j]=H end local E if(serverConfig.getValues()).useDefaultEmotes then E=Cryo.Dictionary.join(defaultEmotes,M,L)else E=L end local P={}for j,H in pairs(E)do if H.emote then P[j]={H.emote}end end H:SetEmotes(P)A.playerEmoteConfig[j.UserId]=E A.remotes.sendUpdatedEmotes:FireClient(j,E)end

function EmoteManager:updateEmotes(player, humanoidDescription)
	local ownedEmotes = self.playerOwnedEmotes[player.UserId] or {}

	-- Find emotes set by setEmotes
	local configuredEmotes = emotes.getValues()
	local externalEmotes = {}
	for emoteName, emoteInfo in pairs(configuredEmotes) do
		-- Filter out default and paid emotes from the configuredEmotes
		if defaultEmotes[emoteName] and defaultEmotes[emoteName].emote == emoteInfo.emote then
			continue
		elseif paidEmotes[emoteName] and paidEmotes[emoteName].emote == emoteInfo.emote then
			continue
		end

		externalEmotes[emoteName] = emoteInfo
	end

	local newEmoteConfig
	if serverConfig.getValues().useDefaultEmotes then
		-- Combine default emotes, paid emotes, and any emotes set via setEmotes
		newEmoteConfig = Cryo.Dictionary.join(defaultEmotes, ownedEmotes, externalEmotes)
	else
		-- Only send emotes configured by setEmotes
		newEmoteConfig = externalEmotes
	end

	-- Add default and owned emotes to the player's humanoid
	-- description so that they can be played using the PlayEmote function
	local humanoidEmotes = {}
	for emoteName, emote in pairs(newEmoteConfig) do
		-- Only add Emotes that use emote asset ids. Ignore Emotes that use
		-- animation asset ids.
		if emote.emote then
			humanoidEmotes[emoteName] = { emote.emote }
		end
	end
	humanoidDescription:SetEmotes(humanoidEmotes)

	self.playerEmoteConfig[player.UserId] = newEmoteConfig
	self.remotes.sendUpdatedEmotes:FireClient(player, newEmoteConfig)
end
