Help with Admin Panel/MessagingService

Hello! I am developing an advanced Admin Panel and one of the features is PlayerServerJoin. You enter the player’s username and it looks for them in every game server. If they aren’t in the game, it tells the admin. What I need help with is the MessagingService end of this system. I am new to MessagingService and am wondering if anybody could help.

1 Like

To use MessagingService, You have to Subscribe first.

local MessagingService = game:GetService("MessagingService")

MessagingService:SubscribeAsync("FindPlayerInServer", function(Player)
	print(Player.Data)
	print(Player.Sent)
	local plr = Player.Data
for _, v in pairs(game.Players:GetPlayers()) do
  if v.UserId == plr.UserId then
    -- if we find playe. notice to admin
MessagingService:PublishAsync("SendMessageToAdmin", true) 
  end
 end
end)

We need new Subscribe for Send if find player:

local MessagingService = game:GetService("MessagingService")

MessagingService:SubscribeAsync("SendMessageToAdmin", function(isInGame)
	print(isInGame.Data)
	print(isInGame.Sent)
	for _, v in pairs(game.Players:GetPlayers()) do
  if v.UserId == adminsid and isInGame.Data then
  --ex)  v.PlayerGui.AdminGui.FoundLabel.Text = "Found"
  end
 end
end)

After we have to Publish when admin click search button.

MessagingService:PublishAsync("FindPlayerInServer", Player)

If this don’t work, check this: MessagingService

1 Like

Would it be possible to fetch the JobId of the server they are in?

Yes.
https://developer.roblox.com/en-us/api-reference/function/TeleportService/GetPlayerPlaceInstanceAsync

1 Like