How to put a shirt id on a character using script?

I have a game and I want there to be character customization
But idk how to add a shirt id to the character
I tried ShirtTemplate and ApplyDescription but nothin worked
Btw im not looking for a script just looking for a way to put a shirt id on the character

Picture:

Script

Next = Label.Next
Back = Label.Back
Count = 1
Character = workspace.CustomizableCharacter
ShirtIds = {1821394,5929995954,5960301418,6664129832,6456895422}

Back.Activated:Connect(function()
	if Count > 1 then
		Count -= 1
		Label.Text = Label.Name..(" ")..Count
                --???
	end
end)
 
Next.Activated:Connect(function()
	if Count < 5 then
		Count += 1
		Label.Text = Label.Name..(" ")..Count
                --???
	end
end)

Pretty sure you need to apply the Shirt | Roblox Creator Documentation from a shirt you get from the toolbox.

Yeah but I have a list of shirt ids I want to put on the character so I can pick different shirts

Should probably edit the post to say that

Im not an expert scripter, but i think you could use tables to hold all the ids.

Already have done that I just want to know how to put the ids onto the character

dang, then i have now idea sry

easy! instance a “Shirt” object and parent it to the model using Instance.new("Shirt", Character), then set the shirt’s Id to the id in the table.

be sure to include a humanoid in the Character model!! :grinning_face_with_smiling_eyes:

Ok give me a second to try that out thank u

Didn’t work am I doing something wrong?

Label = script.Parent
Next = Label.Next
Back = Label.Back
Count = 1
Character = workspace.CustomizableCharacter
ShirtIds = {1821394,5929995954,5960301418,6664129832,6456895422}
Shirt = Instance.new("Shirt",Character)

Back.Activated:Connect(function()
	if Count > 1 then
		Count -= 1
		Label.Text = Label.Name..(" ")..Count
		Shirt.ShirtTemplate = ShirtIds[Count]
	end
end)
 
Next.Activated:Connect(function()
	if Count < 5 then
		Count += 1
		Label.Text = Label.Name..(" ")..Count
		Shirt.ShirtTemplate = ShirtIds[Count]
	end
end)

Can you send a screenshot of the Hierarchy?

Hierarchy of what? (character limit)

The label with the back and next buttons please!

Screen Shot 2021-08-11 at 5.07.14 PM

are the back and next objects a textbutton?

Yep (character limit character limit)

Label = script.Parent
Next = Label.Next
Back = Label.Back
Count = 1
Character = workspace.CustomizableCharacter
ShirtIds = {1821394,5929995954,5960301418,6664129832,6456895422}
Shirt = Instance.new("Shirt",Character)

Back.MouseButton1Click:Connect(function()
	if Count > 1 then
		Count -= 1
		Label.Text = Label.Name..(" ")..Count
		Shirt.ShirtTemplate = ShirtIds[Count]
	end
end)
 
Next.MouseButton1Click:Connect(function()
	if Count < 5 then
		Count += 1
		Label.Text = Label.Name..(" ")..Count
		Shirt.ShirtTemplate = ShirtIds[Count]
	end
end)

You may have been using the wrong event. Give that script a try!

Ik I wasn’t using the wrong events because the script that changed the number worked

Also: GuiButton | Roblox Creator Documentation

Can you send any output errors if there are any?