Honsestly, this seems like one of those things that seem so easy on paper then I try to do it then it just doesnt work out.
I am trying to delete the players shirt (If they have one) then create a new one. All I get it a new shirt instance but the shirt doesnt even show up. I made sure the id is valid. The id I used for this is 3670737444.
script.Parent.OnServerEvent:Connect(function(plr, itemtype, id) -- On server event
if itemtype == "2DShirt" then -- If it should be changing shirt
local hmd = plr.Character.Humanoid.HumanoidDescription -- humanoid desc
local char = plr.Character -- character
for i, v in pairs(char:GetChildren()) do -- deleting current shirt
if v:IsA("Shirt") then
v:Destroy()
end
end
local s = Instance.new("Shirt") -- making new shirt
s.ShirtTemplate = "http://www.roblox.com/asset/?id=" .. id -- 3670737444
s.Name = "Shirt" -- Naming the shirt
s.Parent = char -- Setting the shirts parent
hmd.Shirt = id -- Setting humanoid desc shirt to id
end
end)
script.Parent.OnServerEvent:Connect(function(plr) -- On server event
if plr.Character:FindFirstChild("Shirt") then
plr.Shirt.ShirtTemplate = "rbxassetid://3670737444"
end
end
end)
i dont know if there’s too many or too little 'end’s so just play around with them until it works
script.Parent.OnServerEvent:Connect(function(plr) -- On server event
if plr.Character:FindFirstChild("Shirt") then
plr.Shirt.ShirtTemplate = "rbxassetid://3670737444"
else
local shirt = Instance.new("Shirt")
shirt.Parent = plr
shirt.ShirtTemplate = "rbxassetid://3670737444"
end
end)
IDs you take from the browser link on the avatar shop don’t work if you put them in shirttemplate from a script. To get the real Id, that will work from a script, make a shirt in the studio itself, and put your link into it’s shirt template. You’ll notice that some numbers of the ID change. That’s the ID you need to use in the script
IDs you take from the browser link on the avatar shop don’t work if you put them in shirttemplate from a script. To get the real Id, that will work from a script, make a shirt in the studio itself, and p
did you do it correctly? you need to insert a shirt into studio, and add the id from the catalog. it will change the id in the shirt template, copy that and use it in the script
If this doesn’t work, while in game, go to server view and screenshot me the hierarchy of your character, with the shirt selected so I can see the properties
You want to give it to player, or dummy ? Because if you want to give it to every player, you can use game settings for it. In game settings, go to avatar, then scroll down to clothing section, select which clothing you want to overwrite and give it the ID if the clothing.