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

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

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

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)

7 comments

0

I see some flaws in there. You used the wrong method. :GetRankInGroup() is getting the actual name of their rank. NOT the role.

0

Dude, really? Subtract a rep point? You got the terms mixed up.

0

I didn't do that

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.

0

I just bumped you up.

0

Thank you, if you lose any reputation points out of the blue, I'll bump you up.

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.