Sending a notification to people with a specific rank

Hello! Is it possible to send a message/notification to all in-game players with a specific group rank? If so, how would I do that? Any help is appreciated, thanks!

Just use this: Player:GetRankInGroup

1 Like

But how would I send the notification to everyone with that rank at the same time? Could you provide an example of how it would be in a script?

You can use “SendNotification” when using SetCore on the client( can be triggered with an event).

https://developer.roblox.com/en-us/api-reference/function/StarterGui/SetCore

1 Like

Here’s a script that loops through all the players to find the ones that should receive the message:

local plrs = game:GetService("Players")
local groupId = idhere -- the id of your group
local minrank = ranknumhere -- the minimum rank number required to see the notif

for i,v in pairs(plrs:GetPlayers()) do
	local success, rank = pcall(function()
		return v:GetRankInGroup(groupId)
	end)
	if success then
		if rank then
			if rank>=minrank then
				print("Is allowed")
				--do a notification scipt, maybe use SetCore("SendNorification")
			else
				print("Not allowed!")
			end
		end
	else
		warn("Couldn't retrieve rank: "..tostring(rank))
	end
end
2 Likes