How can my players update the pants or shirts of their mannequins by ID in game? (GUI)

I’m in the process of creating a game which involves players setting up their own clothing stores, changing their mannequins’ clothes to the ones of their desire, ideally being the shirts they have created.
I am currently having problems getting the right asset ids due to them being automatically updated whenever you put them in the ‘‘ShirtTemplate’’ property.
I know there is a solution for this using a normal script, but I am using a LocalScript, because the user should be able to put the ID on a TextBox and then press enter, as in this script i wrote:

--Variables
local TextBox = script.Parent
local Mannequin = workspace.Dummy

--Functions
TextBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		Mannequin.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=" .. TextBox.Text
	end
end)

It does work, however, it doesn’t auto update to the actual asset id, and is instead left blank.

Screen Shot 2024-02-01 at 00.15.51
Screen Shot 2024-02-01 at 00.15.19

Thank you for your time,
Piero.

Is the script client or server?

1 Like

I think the reason it doesn’t work is because your trying to get it in StarterGui. If you want the player to see the GUI use PlayerGui.

--Variables
local Player = game.Players.Localplayer
local TextBox = Player.PlayerGui.ScreenGui.TEXTBOXNAME -- Put the textbox name here
local Mannequin = workspace.Dummy

--Functions
TextBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		Mannequin.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=" .. TextBox.Text
	end
end)
2 Likes

Thanks for the answer, but the problem isn’t the visibility of the Gui. The problem I’m facing is that when the asset id is placed, the mannequin is left unchanged.