Shirt changing gui

i’m making a character customization gui where a player type a shirt ID in a textbox and the text from the textbox get converted into a shirt template id. i tried many many thing but none of them worked.

an example of this is the customization of Ro Piece

You can achieve this by getting the text within a textbox and then changing the shirt id of the character. Though if you want everyone to see the shirt change you may need to use RemoteEvents.

the problem of doing it like that is that th id you get from the site is differents from the template id so if i do it like that it doesn’t work

Rather than setting the ID of the shirt with just the number you can set it using this https://www.roblox.com/catalog/<ShirtId>.

Possible solution:

-- Client
RemoteEvent:FireServer(Textbox.Text)

-- Server
RemoteEvent.OnServerEvent:Connect(function(Player, ShirtId)
    local Shirt = Player.Character:FindFirstChildOfClass("Shirt")
    Shirt.ShirtTemplate = "https://www.roblox.com/catalog/" .. ShirtId
end)

yes i tried doing that but the problem is the ShirtId because if you use the id the player wrote in the textbox it doesn’t work (because the id you take from the roblox site is different from the tamplate id you need inside the ShirtTemplate)

I managed to load a shirt through the use of InsertService with the original id like so:

local Shirt = game:GetService("InsertService"):LoadAsset(5607261527).Shirt
Shirt.Parent = game.Workspace.Dummy

Please note you may need to remove the previous shirt if it exists.

tried that too but you need the physical id you cant use the textbox text or so is what happened to me

Make sure you use tonumber() so it works.

Using @yasir10001 example this should work:

-- Client
RemoteEvent:FireServer(tonumber(Textbox.Text)) 

-- Server
RemoteEvent.OnServerEvent:Connect(function(Player, ShirtId)
	local Model = game:GetService("InsertService"):LoadAsset(ShirtId)
	if Model:FindFirstChildOfClass("Shirt") then
		if Player.Character:FindFirstChildOfClass("Shirt") then
			Player.Character:FindFirstChildOfClass("Shirt"):Destroy()
		end
		Model.Shirt.Parent = Player.Character
	end
	Model:Destroy()
end)
2 Likes

nevermind i think i made it work i just need to test a few more things

thanks i’m gonna try it but i think i works

This script worked for me. Below is the full scripture:

-- LOCAL SCRIPT
local TextBox = -- put wherever your text box is here
local RemoteEvent = -- put wherever your remote event is here

TextBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then -- if the Enter button was pressed
		RemoteEvent:FireServer(TextBox.Text)
	end
end)




-- SERVER SCRIPT --
local RemoteEvent = -- the same RemoteEvent from before

RemoteEvent.OnServerEvent:Connect(function(player, ShirtId)

	local Character = player.Character or player.CharacterAdded:Wait()
	local Shirt = Character:FindFirstChildWhichIsA("Shirt")

	if not Shirt then -- if the shirt object does not exist in character
		local NewShirt = Instance.new("Shirt")
		Shirt = NewShirt
		Shirt.Parent = Character
	end
	
	Shirt.ShirtTemplate = "rbxassetid://" .. ShirtId
end)
1 Like

thank you very much it works very well

and thank you for trying to help me

“rbxassetid://” doesn’t work with the original id from the URL.