Anything I need to change in the script?
Here is the full script(uniform part is already working btw)
´´lua
local clickpart = script.Parent.resource.ClickPart
local Pants = script.Parent.resource.RankShirts.Pants
local s = script.Parent.resource.RankShirts
local gid = 14596202
– Shirts
local lt = s.LT_shirt
local slt = s.SLT_shirt
local cpt = s.CPT_shirt
local maj = s.MAJ_shirt
local mgen = s.MGEN_shirt
– Cap Function
game.Players.PlayerAdded:Connect(function(plr)
clickpart.ClickDetector.MouseClick:Connect(function()
if plr:GetRankInGroup(gid) == 11 then
plr.Character.Shirt.ShirtTemplate = lt.ShirtTemplate
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
elseif plr:GetRankInGroup(gid) == 12 then
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
plr.Character.Shirt.ShirtTemplate = slt.ShirtTemplate
elseif plr:GetRankInGroup(gid) == 13 then
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate
elseif plr:GetRankInGroup(gid) == 14 then
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
plr.Character.Shirt.ShirtTemplate = maj.ShirtTemplate
elseif plr:GetRankInGroup(gid) == 18 then
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
plr.Character.Shirt.ShirtTemplate = mgen.ShirtTemplate
elseif plr:GetRankInGroup(gid) == 255 then
plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate
-- Cap Giver
local cap = script.Parent.resource.Cap
local primary = cap.Block
local blockWeld = primary.WeldConstraint
--
local newCap = cap:Clone()
blockWeld.Part1 = plr.Character.Head
newCap.Parent = plr.Character.Head
end
end)
local cap = script.Parent.resource.Cap
local newcap = cap:Clone
local plr = game.Players.PlayerAdded:Wait()
plr.CharacterAdded:Connect(function(char)
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
humanoid:AddAccessory(newcap)
end)
Make sure cap is accessory and has HatAttachment in Handle
Hope it helped