Why default clothing script dont working

Hello dev’s!

I retried make default clothing script but it wont work again(With unknown reason)

Script:

Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)
Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)

Have a nice day! (Sorry my english is bad)

3 Likes

If you open up Game Settings in the Roblox Studio then click Avatar you can scroll down to Clothing … From there you can override T-Shirt, Shirt and Pants. Making them default Clothing for all.

Im not mean this.

I mean if player dont have clothing, then game wear player.

1 Like

I messed around with this from your other question and I don’t think you can have no Clothing. From what I seen Roblox will put a default set on the player calling them Clothing.

1 Like

Maybe try detecting if they have that set on and change them directly from their templates.
PantsTemplate and ShirtTemplate … just swap the rbxassetid://??? with yours.

1 Like

I tried this, but character dont weared clothes (Studs)
image

Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Pants == 0 then
		local pants = Instance.new("Pants",plr.Character)
		pants.PantsTemplate = "http://www.roblox.com/asset/?id=240589253"
	end
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)
Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Shirt == 0 then
		local shirt = Instance.new("Shirt",plr.Character)
		 shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=750876671"
	end
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)

I repeat, i want if character dont have any clothing game wearing clothing(Studs):

image

2 Likes

Try this:

Players.PlayerAdded:Connect(function(plr)
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end

    if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end

	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)

You’re unnecessarily connecting the function twice, which results in only one of them working.

Hope this helps!

1 Like

Sorry for the unexpected, i tested again and its not worked :slightly_frowning_face:

1 Like

You should be able to straight forward change both by the names Shirt and Pants.
Using ShirtTemplate and PantsTemplate … maybe give it time to load everything then swap.

1 Like

Try adding plr.CharacterAdded:Wait() before DefaultCharacterDesc. It’s probably not working because you’re trying to load the player’s character before it even finished loading.

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Wait() -- waits for the character to load
	
	local DefaultHumanoidDesc = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end
	
	if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end
	
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)
1 Like

Not worked, sorry man… Have a good day!

1 Like

Not working, only like this:

image

1 Like

But after few seconds this script wearing studs clothing :partying_face:
@2112Jay

1 Like

Try this one. I modified @2112Jay’s code to instead of getting the HumanoidDescription from UserId, get the HumanoidDescription from the Humanoid itself!

Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	local hum = char:FindFirstChildOfClass("Humanoid")
	
	local DefaultHumanoidDesc = hum:GetAppliedDescription()
	
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end

	if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end
	
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)

To get the HumanoidDescription from the Humanoid, simply use Humanoid:GetAppliedDescription().

2 Likes

Oops didnt saw that while typing :sweat_smile: try my modified code if it’s faster

1 Like

image

Strange code

1 Like

try again, i did a little change to the code earlier

1 Like

If you canged, please reply, not edit previos reply.

1 Like

here is changed code

Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	local hum = char:FindFirstChildOfClass("Humanoid")
	
	local DefaultHumanoidDesc = hum:GetAppliedDescription()
	
	if DefaultHumanoidDesc.Shirt == 0 then
		DefaultHumanoidDesc.Shirt = 750876673
	end

	if DefaultHumanoidDesc.Pants == 0 then
		DefaultHumanoidDesc.Pants = 240589254
	end
	
	plr:LoadCharacterWithHumanoidDescription(DefaultHumanoidDesc)
end)

image
Nothing changed

1 Like