Need help with shirt trying on gui

Ok so i’m trying to make it so that when a textbutton is clicked the players shirt gets replaced with a different one but I quite honestly have no idea how, this is the script i’ve got which obviosuly doesn’t work, but does anyone have any ideas on how I could make it functional?
image
this is the only error I get
image
it’s a local script btw

1 Like

The error tells you everything you need to know. LocalPlayer is a member of game.Players, not game.Workspace

2 Likes

Adding onto that, your shirt will have to be put on the LocalPlayer.Character, not the local player.

2 Likes

I’m pretty sure you can’t get local player from workspace. local player would be game:GetService(“Players”).LocalPlayer. make sure the button script is in a local script as well.

2 Likes

ok well i’ve got this now but i’m still very confused
image
I know like the bare minimum about scripting

you need to declare the local player, players is all the players in game.

local customer = game:GetService("Players").LocalPlayer

2 Likes

Try

customer.LocalPlayer.Character.Shirt.ShirtTemplate = "" -- ID here

Or for the full code,

local customer = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	customer.Character.Shirt.ShirtTemplate = "" -- ID here
end)

yeah thats what i’ve got now
image
nothing is happening now, no errors or anything

That’s weird, let me remake it really quickly.

Replace the ID with “http://www.roblox.com/asset/?id={}” – Replace {} with your ID.

You need to use the shirt’s texture ID, not the actual asset ID.

1 Like

I changed it to that and it still didn’t work, this is where i’ve got it if I maybe messed something up with that
image

Yeah, check my edit I made. See if that works.

1 Like

where do I get the texture id from btw?

if you import the shirt to roblox studio, under the shirt is the texture id.

1 Like

My way is to ;

Put the asset ID into a shirt instance, then it should automatically change it to the texture ID URL.

1 Like

Oh wait I figured it out…
I didn’t put a colon there lol
image
okay thank you both for your help I really appreciate it

1 Like

that’s a much better way than mine. never thought of that!

1 Like

Your welcome! :smile_cat: If you need any help don’t hesitate to reply again.

1 Like

no problemmo! have a good day!

1 Like