I don't know how to update the appearance of the dummy using the player character

Is there a way to make the dummy character update if Applydescription is used again? Or is there another way to achieve this?

The issue is that the player’s character updates to the dummy, all good there. However, when I remove a shirt from the player character, the dummy doesn’t update. I can initiate the function and everything, and it detects that the player character changes to call the function, is there any way to make Applydescription update the dummy if the player’s character changes shirts or accessories are removed?

I’ve already tried looking at the documentation for Applydescription, but I can’t find anything that helps. I’ve tried other methods, but none of them worked.

local function updateDummy(player)
	local dummy = dummies[player.UserId]

	if dummy then
		local character = player.Character
		if character then
			local humanoid = dummy:FindFirstChild("Humanoid")
			if humanoid then
				humanoid:ApplyDescription(character.Humanoid:GetAppliedDescription())
			end
		end
	end
end

local function cloneDummy(player)
	local newDummy = DummyTemplate:Clone()
	newDummy.Parent = WorkspaceOutfits
	newDummy:SetPrimaryPartCFrame(DummyTemplate.PrimaryPart.CFrame + Vector3.new(#dummies * 0, 0, distanceBetweenDummies))

	dummies[player.UserId] = newDummy

	return newDummy
end

1 Like

you can try to reload the character every time you want to add a clothes, like evey time you add a clothes, just add it into a table then reload it and add the clothes into your character again, and when you unequip your clothes then delete it form the table and reload

i don’t understand very good, how i do that?

ah you mean that i do a table for the shirts and accesories and everything?

Hi, so apparently, what Roblox does is that once you used ApplyDescription(), it will cache and not update your appearance, as said in this post

So the best thing is to do is to get the humanoid description of the dummy, store in a table, then use ApplyDescription using Roblox’s id (0), then use ApplyDescription with the humanoid description you stored in the table.

i triend that now but it doesn’t update the dummy appearance, i mean i want that if the player eliminates a shirt from his player character then the dummy gets updated and you can see the change in the dummy

local function updateDummy(player)
	local dummy = dummies[player.UserId]
	
	local UserID1 = game.Players:GetHumanoidDescriptionFromUserId(1)
	local PlayerUserID = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
	
	if dummy then
		local character = player.Character
		if character then
			local humanoid = dummy:FindFirstChild("Humanoid")
			if humanoid then
				humanoid:ApplyDescription(UserID1)
				humanoid:ApplyDescription(PlayerUserID)
			end
		end
	end
end

i tried this

You should use the dummy’s humanoid description and Roblox’s humanoid description. Don’t use the player’s character humanoid description.

There should be a HumanoidDescription in the dummy character.

But that is going to work so in game if the player character removes a shirt of his player character or puts a new shirt then the change is going to be updated in the dummy?

I’m not entirely sure what you are trying to do in your game? Do you want it so that when a player wears a shirt, it does the same for the dummy?

1 Like

Yes, and if the player deletes a shirt of his player character then the dummy gets updated with the change

I mean the dummy is a copy of the player character, so i want that the copy gets updated

Create a humanoid description for the dummy then. If a player wears a shirt you can do HumanoidDescription.ShirtID = …, then use ApplyDescription with the dummy’s character.

Do you have the code showing the player wearing a shirt/deleting a shirt?

well the function “updateDummy” gets called at the start and when the player character gets a child added or child removed

You haven’t typed sufficient code to solve your own problem.

If you want a dummy to have a shirt that a player just used, then you can’t use the player’s humanoid description because that is what they are wearing on the Roblox website, not in game.

You should be able to detect when a player wears a shirt and simply add that into the dummy’s shirt.

local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local detectChangedEvent = ReplicatedStorage.DetectChanged

-- Reference to the WorkspaceOutfits folder and the Dummy1 template
local WorkspaceOutfits = Workspace.WorkspaceOutfits
local DummyTemplate = ReplicatedStorage.Dummy1
local distanceBetweenDummies = -5  -- Adjust the distance between dummies here
local dummies = {}

local function updateDummy(player)
	local dummy = dummies[player.UserId]
	
	if dummy then
		local humanoid = dummy:FindFirstChild("Humanoid")

		local UserID1 = game.Players:GetHumanoidDescriptionFromUserId(humanoid)
		local PlayerUserID = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)

		local character = player.Character
		if character then
			if humanoid then
				humanoid:ApplyDescription(UserID1)
				humanoid:ApplyDescription(PlayerUserID)
			end
		end
	end
end

-- Clone a new dummy for the player and store it in the dummies table
local function cloneDummy(player)
	local newDummy = DummyTemplate:Clone()
	newDummy.Parent = WorkspaceOutfits
	newDummy:SetPrimaryPartCFrame(DummyTemplate.PrimaryPart.CFrame + Vector3.new(#dummies * 0, 0, distanceBetweenDummies))

	dummies[player.UserId] = newDummy

	return newDummy
end

-- Connect the updateDummy function to the DetectChanged event on the server
detectChangedEvent.OnServerEvent:Connect(updateDummy)

-- Update the positions of all dummies when a player is added or removed
local function updateDummies2()
	local totalPlayers = #Players:GetPlayers()
	local offset = Vector3.new(0, 0, 0)  -- Initialize the offset

	for i, player in pairs(Players:GetPlayers()) do
		local dummy = dummies[player.UserId]

		if not dummy then
			dummy = cloneDummy(player)
		end

		-- Adjust the position based on the index
		dummy:SetPrimaryPartCFrame(DummyTemplate.PrimaryPart.CFrame + offset)
		offset = offset + Vector3.new(0, 0, distanceBetweenDummies)  -- Add the distance between dummies to the offset
	end

	-- Remove dummies of players who have left
	for userId, dummy in pairs(dummies) do
		if not Players:GetPlayerByUserId(userId) then
			dummy:Destroy()
			dummies[userId] = nil
		end
	end
end

-- Connect the updateDummies function to the PlayerAdded event
Players.PlayerAdded:Connect(updateDummies2)

-- Connect a function to remove the dummy when a player leaves
Players.PlayerRemoving:Connect(function(player)
	local dummy = dummies[player.UserId]
	if dummy then
		dummy:Destroy()
		dummies[player.UserId] = nil
	end

	updateDummies2()
end)

well this is what i have, soo i don’t need to use Applydescription because it uses the player character from the web and is not going to reflect changes in game?

because what i need now is that if the player character changes in game like the shirts or gets removed a shirt in the game then the copy of his character in the dummy i want that gets updated with the changes

1 Like

this is the local script, btw i think that i can add what does the local script in the server script

local player = game:GetService("Players").LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local detectChangedEvent = replicatedStorage.DetectChanged

local function characterChanged()
	local character = player.Character
	if character then
			detectChangedEvent:FireServer()
	end
end

-- Conectar la función a los eventos adecuados
player.CharacterAdded:Connect(function()
	characterChanged()
end)

player.Character.ChildAdded:Connect(function()
	characterChanged()
end)

player.Character.ChildRemoved:Connect(function()
	characterChanged()
end)

Creating a ChildAdded event of the character does not detect when a player is using a shirt and a ChildRemoved event does not detect if a player removed a shirt, it’s only relevant for tools or accessories.

You should have code where a player is able to wear a shirt, otherwise how is it possible for the player to change their shirt in the first place.

Well idk but i checked it with prints and the function runs if i eliminate a shirt in the player character

Oh… so instead of setting the Shirt ID to 0, you delete the shirt instance/object? (Shirt:Destroy())