Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I add more than one role id in this script?

local Pants = script.Pants
local Shirt = script.Shirt

local GroupID = 6763603 

script.Parent.ClickDetector.MouseClick:connect(function(Player)
    if not Player:IsInGroup(GroupID) then return end
    if Player:GetRankInGroup(GroupID) < 255 then return end -- Role Id
    local Character = Player.Character
    if Character == nil then return end

    -- Get new shirt
    local CharacterShirt = Character:findFirstChild("Shirt")
    if CharacterShirt then CharacterShirt:Destroy() end
    Shirt:Clone().Parent = Character

    -- Get new pants
    local CharacterPants = Character:findFirstChild("Pants")
    if CharacterPants then CharacterPants:Destroy() end
    Pants:Clone().Parent = Character
end)

How can I make it so I can have more than role Id in this script So it work's for others to?

2 comments

0

you could put multiple ids in a table and loop through

0

How would I do that?

1 answer

✓ Accepted answer

You would need to put an "or" after the first role id. This is how it should look:

local Pants = script.Pants
local Shirt = script.Shirt

local GroupID = 6763603 

script.Parent.ClickDetector.MouseClick:connect(function(Player)
    if not Player:IsInGroup(GroupID) then return end
    if Player:GetRankInGroup(GroupID) > 255 or >123 then return end --Replace the second number with you number. 
    local Character = Player.Character
    if Character == nil then return end

    -- Get new shirt
    local CharacterShirt = Character:findFirstChild("Shirt")
    if CharacterShirt then CharacterShirt:Destroy() end
    Shirt:Clone().Parent = Character

    -- Get new pants
    local CharacterPants = Character:findFirstChild("Pants")
    if CharacterPants then CharacterPants:Destroy() end
    Pants:Clone().Parent = Character
end)

4 comments

0

It give's me this error "Error: (8,48) Expected identifier when parsing expression, got '>'"

0

Oh sorry. Instead of > put == on both of those.

0

Thanks it work's :)

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.