I have created this script for a friend to where you have to be a certain rank to use the uniform. When I click on the button, it just makes my clothes black and doesn't assign the correct shirt/pants. What am I doing wrong?
local Player = game:GetService("Players").LocalPlayer --Settings-- local rank = Player:GetRankInGroup(2561970) local Uniform = {} Uniform.Shirt = "http://www.roblox.com/STARBUCKS-HR-Uniform-item?id=239299022" Uniform.Pants = "http://www.roblox.com/STARBUCKS-HR-Uniform-Shorts-item?id=239299059" --function-- if rank >= 49 then function AddUniform(P) local Character = P.Character repeat wait(0) until Character ~= nil for i,Object in next,Character:GetChildren() do if Object:IsA("Shirt") or Object:IsA("Pants") then Object:Destroy() end end local Shirt = Instance.new("Shirt",Character) Shirt.ShirtTemplate = Uniform.Shirt local Pants = Instance.new("Pants",Character) Pants.PantsTemplate = Uniform.Pants end end --GUIPart-- local Bin = script.Parent if Bin:IsA("TextButton") or Bin:IsA("ImageButton") then Bin.MouseButton1Down:connect(function() AddUniform(Player) end) end