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

How do I make it so that a specific group rank gets a gun?

Asked by
Swabb 0
10 years ago

I have this group and I want this specific rank to have a gun in-game. But it has to be only that rank.

2 answers

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

This script should work on respawn, only the rank and group id specified will get the item.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if player:GetRankInGroup(000000) >= 000 then --Change to GroupId and Rank Number.
            game.ServerStorage.GUNNAMEHERE:Clone().Parent = player:WaitForChild("Backpack")
        end
    end)
end)
0
I see some flaws in there. You used the wrong method. :GetRankInGroup() is getting the actual name of their rank. NOT the role. Shawnyg 4330 — 10y
0
Dude, really? Subtract a rep point? You got the terms mixed up. M39a9am3R 3210 — 10y
0
I didn't do that Shawnyg 4330 — 10y
View all comments (3 more)
0
Hmm... It's been happening to me all day, anyone else? I don't think it's the OP since we're helping him. M39a9am3R 3210 — 10y
0
I just bumped you up. Shawnyg 4330 — 10y
0
Thank you, if you lose any reputation points out of the blue, I'll bump you up. M39a9am3R 3210 — 10y
Ad
Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

This isn't that hard if you take the time to read through the Wiki.

id = 1337 --Group ID
rank = 1 --The Role of the rank
game.Players.PlayerAdded:connect(function(plr)
    if plr:IsInGroup(id) and plr:GetRankInGroup(id) == rank then --Change it to >= if you want to be all ranks above as well.
        repeat wait() until plr.Backpack
        tool = game.ServerStorage["Tool name here"]:clone()
        tool.Parent = plr.Backpack
        --tool.Parent = plr.StarterGear
        --Above is if you want it to stay with them
    end
end)

-Thank me by accepting this answer/bumping up my reputation!

Answer this question