Load Asset Clothings In StarterCharacter

Load Asset Clothings In StarterCharacter

Why do I need it?
I’m make game from “Bulked Up” But. In Game Character Player Load.
But My StarterCharacter no load character player.

I searched and answered but no one answered my questions.

Questions

I want load player clothing in StarterCharacter

I no mean is no username or id.

I mean player than him clothing load in StarterCharacter

I don’t know how to say this but I made a screenshot.

No Clothing

Clothing

The script that gives you your clothes

3 Likes

Someone Reply or a world of empty Answers?

What are you trying to do? It seems like the clothing already loads. Sorry but I don’t seem to understand what you’re saying.

1 Like

I’m mean, Script Load Your Clothing In StarterCharacter

I don’t understand what you are saying.

However, I must say, your character has bigger calves than me and I’m jealous

1 Like

Script Gave “Your” Clothing Wear in StarterCharacter.

If you still don’t understand, look at the pictures.

The pictures only tell me the clothing lodead correctly

1 Like

Oof. I’m said "Script Load Your Clothing

I think what you mean is you want to know how to get a player’s clothing and add it to a custom character.

You can get the player’s HumanoidDescription with Players:GetHumanoidDescriptionFromUserId.

Once you get a HumanoidDescription for the player, you can get their clothing with:

https://developer.roblox.com/api-reference/property/HumanoidDescription/Shirt

https://developer.roblox.com/api-reference/property/HumanoidDescription/Pants

https://developer.roblox.com/api-reference/property/HumanoidDescription/GraphicTShirt

After you get the shirt, pants, or t-shirt ID, you can create a new clothing item with Instance.new and set it’s content id.

Example for a shirt:

Get the content id, create a new shirt (Instance.new("Shirt")), set Shirt.ShirtTemplate, and add the new shirt to the character.

1 Like

I’m no Scripter or Programmer, Sorry But i’m can’t scripting

1 Like

This would be an example of some code that would go into StarterCharacterScripts:

local Players = game:GetService("Players")

local baseUrl = "rbxassetid://"

local character = script.Parent
local player = Players:GetPlayerFromCharacter(character)

local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
local shirtId = humanoidDescription.Shirt

local newShirt = Instance.new("Shirt")
newShirt.ShirtTemplate = baseUrl..shirtId
newShirt.Parent = character

Generally #help-and-feedback:scripting-support is for help with scripting. If you’re looking for someone to code stuff for you, the talent hub is a good place for that.

If that code doesn’t work you can private message me and I can fix it :+1:

1 Like

Uhhh…

My Shirt No Loaded. So Script Gave No Random Shirt.

Script Gave [ Your ] Shirt

Png (2)

My Shirt Not Load To StarterCharacter.

1 Like

Oops! I didn’t realize what the HumanoidDescription.Shirt was. I thought it was the shirt texture ID, but it’s the catalog item ID.

This code should be fixed:

local Players = game:GetService("Players")
local InsertService = game:GetService("InsertService")

local character = script.Parent
local player = Players:GetPlayerFromCharacter(character)

local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
local shirtId = humanoidDescription.Shirt

local newShirt = InsertService:LoadAsset(shirtId):FindFirstChildOfClass("Shirt")
newShirt.Name = "Shirt"
newShirt.Parent = character
4 Likes

THX IS WORKED, YOU ARE GOOD PROGRAMMER :+1: :sunglasses: :+1:

local players = game:GetService("Players")
local character = script.Parent
local player = players:GetPlayerFromCharacter(character)

local description = players:GetHumanoidDescriptionFromUserId(player.UserId)

local shirt = character:FindFirstChildOfClass("Shirt") or Instance.new("Shirt")
shirt.Name = "Shirt"
shirt.ShirtTemplate = "rbxassetid://"..description.Shirt
shirt.Parent = shirt.Parent or character

This would be arguably more performant, bare in mind the player’s character may already have a shirt equipped.

This is actually like what I had originally, but it didn’t work. The ShirtTemplate needs an image ID, while the HumanoidDescription.Shirt is the ID of the purchasable shirt in the catalog.

1 Like

Yeah, I almost forgot about that weird quirk.

local players = game:GetService("Players")
local character = script.Parent
local player = players:GetPlayerFromCharacter(character)

local appearanceModel = players:GetCharacterAppearanceAsync(player.UserId)
local oldShirt = appearanceModel:FindFirstChildOfClass("Shirt")

if oldShirt then
	local newShirt = character:FindFirstChildOfClass("Shirt") or Instance.new("Shirt")
	newShirt.Name = "Shirt"
	newShirt.ShirtTemplate = "rbxassetid://"..oldShirt.ShirtTemplate
	newShirt.Parent = newShirt.Parent or character
end
appearanceModel:Destroy()

Anyway to add hats into this? Need it for my game!

1 Like