Need help with a "!uniform" command

Hello! I am trying to make a script so that if a player chats “!uniform” that they get the uniform if their rank is above a certain role in a group. I got the whole group thing working, now its just that the actual giving the clothing to the player is not working and I keep getting an error.

Error:
[19:36:11.749 - Image "https://www.roblox.com/catalog/5121943153/Uniform-Pants" failed to load in "Workspace.Federal_Enforcer107.Humanoid.Clothes": Request failed](rbxopenprop://1%2E1850268/Clothes)
This is my code:
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg == “!uniform” then
if player:GetRankInGroup(4978658) >= 4 then
local foundShirt = player.Character:FindFirstChild(“Shirt”) – Tries to find Shirt

player.Character.Shirt.ShirtTemplate = "https://www.roblox.com/catalog/5121938459/LR-Uniform"
--local newShirt = Instance.new("Shirt",player.Character)
--newShirt.Name = "Shirt"
                        	
local foundPants = player.Character:FindFirstChild("Pants") -- Tries to find Pants
player.Character.Pants.PantsTemplate = "https://www.roblox.com/catalog/5121943153/Uniform-Pants"
--local newPants = Instance.new("Pants",player.Character)
--newPants.Name = "Pants"
                        	
--player.Character.Shirt.ShirtTemplate = 5121938459
--player.Character.Pants.PantsTemplate = 5121943153
 else
end
end
end)
end)

Thanks for the help!

I know this might sound really dumb and extra, but maybe make an admin command, that does the function.

1 Like

It’s because you didn’t made the shirt, or the shirt isn’t Public or for sale, or hasn’t been approved by roblox staff.

1 Like

It is for sale.

Link to shirt.

Link to pants.

I also tried using http://www.roblox.com/asset/?id=

It’s because you’re attempting to put the DIRECT website link in it, make this:

Make a shirt or pant in ServerStorage
Place the link of it in the shirt or pant
Wait until link changes
Copy the link (FROM THERE)
Place it on your code

Like this! https://gyazo.com/7bb952ebb594ba1d5dbb92088d1c1b01

2 Likes

honestly, i am not really good at scripting but try changing https://ww.robloxcom/catalog to http://www.roblox.com/asset/?id=

2 Likes

Thanks for the help! It worked!

1 Like

What if you needed this to work for multiple ranks? Would I just copy and paste the whole script onto a new line?