Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Clothing script needs editing for a group purpose, can anyone help?

Asked by 6 years ago
pnts = script.Pants
shirt = script.Shirt

function GiveClothes(character)
if not character:findFirstChild("Shirt") then 
shirt:Clone().Parent = character
else character:findFirstChild("Shirt"):Destroy()
shirt:Clone().Parent = character
end

if not character:findFirstChild("Pants") then 
pnts:Clone().Parent = character
else character:findFirstChild("Pants"):Destroy()
pnts:Clone().Parent = character
end
end

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(char)
wait(1.12)
local plr = game.Players:findFirstChild(char.Name)
print(char.Name)

if plr.TeamColor ~= BrickColor.new("Dark blue") then 
return
else GiveClothes(char)
end
end)
end)

I need it so if your between a certain rank in the group your given the clothes.I can't figure out what or where I would put it.

2 answers

Log in to vote
0
Answered by 6 years ago

Bumping

Ad
Log in to vote
0
Answered by 6 years ago
GiveClothes = function(char)
    for i,v in pairs(char:children()) do
        if v:IsA("Clothing") then
            v:Destroy()
        end
    end
    script.Pants:Clone().Parent = char
    script.Shirt:Clone().Parent = char
end

GroupId = 0
RanksThatGetClothing = {"Rank Name","Other Rank Name"}

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        local allowed = false
        for i,v in pairs(RanksThatGetClothing) do
            if v:GetRoleInGroup(GroupId) == v then
                allowed = true
            end
        end
        if allowed then
            GiveClothes(char)
        end
    end)
end)

Answer this question