I have this group and I want this specific rank to have a gun in-game. But it has to be only that rank.
COMMUNITY QUESTION
How do I make it so that a specific group rank gets a gun?
2 answers
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)
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
I see some flaws in there. You used the wrong method. :GetRankInGroup() is getting the actual name of their rank. NOT the role.
No flaw; http://wiki.roblox.com/index.php/GetRoleInGroup_%28Method%29
Dude, really? Subtract a rep point? You got the terms mixed up.
I didn't do that
Hmm... It's been happening to me all day, anyone else? I don't think it's the OP since we're helping him.
I just bumped you up.
Thank you, if you lose any reputation points out of the blue, I'll bump you up.