Dummy spawns with a different avatar

Hello I’m trying to make a function where once the player spawns it will clone a dummy and put it in workspace then copy the player’s avatar into the dummy. It works ok but for some reason it uses a random avatar instead of the player’s avatar. I’m pretty sure its “local humanoidDescriptionForOutfit = game.Players:GetHumanoidDescriptionFromOutfitId(player.UserID)” but i dont know what to change it to and im brain dead

local ReplicatedStorage = game.ReplicatedStorage
local Dummy = ReplicatedStorage.Dummy

local function onPlayerAdded(player)
	
	local CDummy = Dummy:Clone()
	
	local UserID = player.UserId
	
	print(UserID)
	
	CDummy.Parent = workspace
	
	local humanoidDescriptionForOutfit = game.Players:GetHumanoidDescriptionFromOutfitId(player.UserID)
	 
	
	CDummy.Humanoid:ApplyDescription(humanoidDescriptionForOutfit)
end

for _, player in pairs(game.Players:GetPlayers()) do
	onPlayerAdded(player)
end

swdeffef.PNG

1 Like
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Dummy = ReplicatedStorage:WaitForChild("Dummy")

local function onPlayerAdded(player)
	local CDummy = Dummy:Clone()
	local UserID = player.UserId
	print(UserID)
	CDummy.Parent = workspace
	local humanoidDescriptionForOutfit = Players:GetHumanoidDescriptionFromUserId(player.UserID)
	CDummy:WaitForChild("Humanoid"):ApplyDescription(humanoidDescriptionForOutfit)
end

Players.PlayerAdded:Connect(onPlayerAdded)

GetHumanoidDescriptionFromUserId() was the function you needed, I added a few other minor changes as well.

2 Likes