function EmoteManager.updateEmotes(V,I,b)local p=V.playerOwnedEmotes[I.UserId]or{}local h=emotes.getValues()local t={}for I,b in pairs(h)do if defaultEmotes[I]and defaultEmotes[I].emote==b.emote then continue elseif paidEmotes[I]and paidEmotes[I].emote==b.emote then continue end t[I]=b end local i if(serverConfig.getValues()).useDefaultEmotes then i=Cryo.Dictionary.join(defaultEmotes,p,t)else i=t end local Z={}for I,b in pairs(i)do if b.emote then Z[I]={b.emote}end end b:SetEmotes(Z)V.playerEmoteConfig[I.UserId]=i V.remotes.sendUpdatedEmotes:FireClient(I,i)end
--[[
	Updates the emote configuration to add default and paid emotes that
	the user owns to it. Also adds these emotes to the user's
	HumanoidDescription so that they can be used by the function
	Humanoid:PlayEmote

	Parameters:
	- player - The Player whose HumanoidDescription is being updated
	- humanoidDescription - The humanoid description to used for getting and
	setting emotes
]]
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
