Why default clothing script dont working

oh okay, seems like @2112Jay is the winner!

2 Likes

Sorry for same reply, but proof game loading player more times:

1 Like

Turn off CharacterAutoLoads.

Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end
	local Model = Players:CreateHumanoidModelFromDescription(DefaultHumanoidDesc)
	
	plr.Character = Model
	
	Model.Parent = workspace
end)
1 Like

This works, the clothing is changing. However It doesn’t seem to show up (everytime).
Are you using custom created clothing, only you own or you have to purchase.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local Pants = char:WaitForChild("Pants")
		local Shirt = char:WaitForChild("Shirt")

		if Pants.PantsTemplate == "http://www.roblox.com/asset/?id=867838635" then
			Pants.PantsTemplate = "rbxassetid://240589254"
		end

		if Shirt.ShirtTemplate == "http://www.roblox.com/asset/?id=855773572" then
			Shirt.ShirtTemplate = "rbxassetid://750876673"
		end
	
	end)
end)

By show up I mean, it’s just not updating to the new set. But they are on the Character.

1 Like
  1. I using clothing from catalog.

  2. This script not working and worse than previous.

1 Like

Try my code here it works I assure you

1 Like

image

But with me not working
I need this(Yellow arms for demostration):
image

1 Like

Same:
image

1 Like

How did you get studs on your arms in the first place?

1 Like

This is clothing, lol…))))))

1 Like

Sorry for same answer, but this script dont working again.

1 Like

That works for me every time … drop that in ServerScriptService as a non-local script.

1 Like

Its actually in ServiceScriptService:
image

1 Like

Script not worked,AGAIN.
Proof script in ServiceScriptService
image

Like I said earlier, Player.CharacterAdded doesn’t fire when the player joins. Try this code that connects Player.CharacterAdded, then waits for the player to load naturally and load the character again to trigger Player.CharacterAdded.

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(char)
		local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
		
		if DefaultHumanoidDesc.Shirt == 0 then
			DefaultHumanoidDesc.Shirt = 750876673
		end
		
		if DefaultHumanoidDesc.Pants == 0 then
			DefaultHumanoidDesc.Pants = 240589254
		end
		
	 	char:FindFirstChildOfClass("Humanoid"):ApplyDescription(DefaultHumanoidDesc)
	end)
	
	if not plr.Character or not plr.Character.Parent then -- if player character didnt load yet
		plr.CharacterAdded:Wait() -- wait for player character to load
	end
	
	plr:LoadCharacter() -- force load the player character again
end)

Also I used Humanoid:ApplyDescription() instead of Player:LoadCharacterWithHumanoidDescription() to prevent the game from loading the player many times.

You don’t need to change the Shirts and Pants in the character Model, Humanoid:ApplyDescription() will take care of that.

This has to have a pause after the Character enters or respawns that is longer than waitforchild().

-- non-local script in ServerScriptService

Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
	local des = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	des.Pants = 4637618900 -- actual free Roblox Pants I own
	des.Shirt = 3670737444 -- actual free Roblox Shirt I own
	plr.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		task.wait() hum:ApplyDescription(des)
	end)
end)

@ TestAccount563344 yes it is …

this is actually a challenge, because some of the clothing will default to roblox ___ shorts/shirt which is not id 0

local Players = game:GetService("Players")

local BlacklistedIDS = {
	855780360,
	855781078,
	855781508,
	855782253,
	855783877,
	855782781,
	855785499,
	855784936,
	855778084,
	855779323,
	855773575,
	855776103,
	855777286,
	855768342,
	855766176,
	855760101,
	0,
}

local function CharacterAdded(Character, Player)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(Player.UserId)
	if table.find(BlacklistedIDS, DefaultHumanoidDesc.Pants) then
		DefaultHumanoidDesc.Pants = 240589254
	end
	if table.find(BlacklistedIDS, DefaultHumanoidDesc.Shirt) then
		DefaultHumanoidDesc.Shirt = 750876673
	end
	
	local Humanoid = Character:WaitForChild("Humanoid")
	
	Humanoid:ApplyDescription(DefaultHumanoidDesc)
end

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAppearanceLoaded:Connect(function(Character)
		CharacterAdded(Character, Player)
	end)

	local Character = Player.Character

	if Character then -- If the character already exists, the CharacterAdded event probably didn't fire until now.
		CharacterAdded(Character, Player)
	end
end)

if you are wondering what the blacklisted ids are, they are all the different colors for the roblox default clothing. i have tested this with r6 characters and it works well. i hope this helps, it took me a while to get all of those ids

1 Like

Just getting that to apply was a task … getting errors off one cpu tick() :unamused:

That just overwrites anything there or not there.
You could add this for have or forced items …

if des.Pants == 0 then
	des.Pants = 4637618900
end

if des.Shirt == 0 then
	des.Shirt = 3670737444
end