I want to award a badge to people that have a specific role in my group

  1. What do you want to achieve? I want to have a special badge for players who have the “Developer” role in my group.

  2. What is the issue? I know how to give badges, no problem. However, I do not know how to check if a player has a role in my group e.g. when a player has the “Developer” role in my group, they get the “Developer” badge. I also don’t know how to check if a user has joined my group

  3. What solutions have you tried so far? I’ve looked for solutions on the dev forum and google. Nothing. I may be writing the question wrong, so nothing relevant appears in the search for me. I can do the badge, no problem. I just need to know how to approach getting the player’s information. I need to know how to see, on player joined (does that player have the “Developer” role in my group). If so, I would award the badge. But how do I get this player’s information?

3 Likes

the rank id variable is in the image (0-255)

local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")

local GroupId
local BadgeId
local RankId

Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) == RankId then
		BadgeService:AwardBadge(Player.UserId, BadgeId)
	end
end)
1 Like

For fix it you can use something like it

local plrs = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")

plrs.PlayerAdded:Connect(function(plr)
	if plr:GetRankInGroup(6228345) == RankId then -- first number is the group and the second number is the id of the rank (0-255)
		BadgeService:AwardBadge(plr.UserId, 1) -- badge id
	end
end)
1 Like

Where should I put it? e.g. ServerScriptService and how do I format the script as (Local script or just a normal script?)

1 Like

You need put it in a Server (normal) script, if it is possible in the ServerScriptService.

If want more info about how to use GetRankInGroup you can see it: Player | Roblox Creator Documentation

1 Like

its any serverscript or legacy that could be on workspace or ServerScriptService

1 Like

You can put the script in workspace if want, but the client can saw the script name, and if its disabled or no, for security reasons (for prevent cheaters) i recommend put it on ServerScriptService, but decompile server script is impossible, and you can put it in workspace if want.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.