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

This script isn't working, can anyone help? It involves clothing and group ranks/id's

Asked by 6 years ago
Edited by evaera 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 = {"Private"}

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)
0
Change v:GetRoleInGroup(GroupId) to plr:GetRoleInGroup(GroupId) F4ULT1NTH3D4T4 226 — 6y
0
Does the :children and :connect need changing like it says below? LordSqaureAlistair 3 — 6y
0
I got it working! Thank you so much!!! LordSqaureAlistair 3 — 6y

3 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

First off: Change all of the :connect to :Connect Put it all in a code block so I can see everything else

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 = {"Private"}

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)

0
The Pants and Shirt ID isn't the same as the Product ID. For example, if the ID for the pants on the catalog is 78690501, in the script, it wouldn't be the same number. Go on catalog, and subtract 1 from the ID number. Keep doing that until you find the product that has the same name as your pants, but the picture looks different. That is the ID you need. Also, use :GetChildren(), not :children. ThePhantomG 30 — 6y
0
I know that there is a pants and shirt object inside the script LordSqaureAlistair 3 — 6y
0
And that didn't fix it anyway :/ LordSqaureAlistair 3 — 6y
Log in to vote
0
Answered by 6 years ago

maybe because you left the group id to 0 ://////////////////////////

0
Still doesn't work LordSqaureAlistair 3 — 6y

Answer this question