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?
this is the only error I get
it’s a local script btw
The error tells you everything you need to know. LocalPlayer is a member of game.Players, not game.Workspace
Adding onto that, your shirt will have to be put on the LocalPlayer.Character, not the local player.
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.
ok well i’ve got this now but i’m still very confused
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
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
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.
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
Yeah, check my edit I made. See if that works.
where do I get the texture id from btw?
if you import the shirt to roblox studio, under the shirt is the texture id.
My way is to ;
Put the asset ID into a shirt instance, then it should automatically change it to the texture ID URL.
Oh wait I figured it out…
I didn’t put a colon there lol
okay thank you both for your help I really appreciate it
that’s a much better way than mine. never thought of that!
Your welcome! If you need any help don’t hesitate to reply again.
no problemmo! have a good day!