How to make random friend on friendlist replace dummy?

Basically I am trying to make a system where it picks a random friend from the users friendlist and replaces the default dummy with the random friends avatar. I have my localscript down below. I don’t get any errors but the dummy doesn’t change appearance.

What I have so far. I’ve been considering restarting the whole script if anyone has any info that I can use in the script. Please let me know.

local usernames = {}
for item, pageNo in iterPageItems(friendPages) do
	table.insert(usernames, item.Username)
end

local friends = {}
for item, pageNo in iterPageItems(friendPages) do
	table.insert(friends, item.Id) 
end

local randomFriend = friends[math.random(#friends)]

local npc = game.Workspace.npc
local newHumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(randomFriend)
npc.Humanoid:ApplyDescription(newHumanoidDescription)

The localscript is also parented to the dummys humanoid if that is important.

Why don’t you try using :CreateHumanoidModelFromUserId(...). This is also in the Game.Players Service, and it should work.

game.Players:CreateHumanoidModelFromUserId(...).Parent = game.Workspace

You can’t use Humanoid:ApplyDescription() on a server-owned rig. You’d have to make a local clone of the dummy and then use ApplyDescription().

Also, is the Localscript even running if it’s a child of the dummy’s humanoid, given that the dummy is a child of the workspace?