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

How to check in all servers if a player is in the game?

So I'm making a player find thing where you can type in the name of a player and then press search, and it tells you if the player is in the game, no matter what server. How do I do this?

4 comments

1

What exactly do you need that for?

0

You know how when Pokemon Brick Bronze still existed it had something like it? I'm kind of doing for that same purpose.

0

You would need to communicate with all servers using messaging service. (send one message to all servers, if a server has one, send a message back to the player's that requested it server.) You can learn about messaging service on a DevHub article: https://developer.roblox.com/en-us/articles/cross-server-messaging

0

I don't understand

1 answer

Here: https://developer.roblox.com/en-us/api-reference/function/Player/GetFriendsOnline This function returns a table of all online friends, and the current server and place. Also return the online status, like when the friend was last online.

Here a example:

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local function ReturnFriendStatus(Name)
	--> "Name" argument is the current name of your friend (if exists)

	local FriendsOnline = Player:GetFriendsOnline(200)
	--> Return a table of friends online (check the link above)

	for Index, Friend in pairs(FriendsOnline) do
		if Friend.UserName == Name and Friend.PlaceId == game.PlaceId then
		--> If any friend has a name that matches to the "Name" argument, and if the current place he is playing has the same id as the place you are playing

			return true --> If is in the same place
		else
			return false --> Or is in another place
		end
	end
end

ReturnFriendStatus("ROBLOX")

If you are not looking to find current friends online in the same game, then that would be your answer: https://developer.roblox.com/en-us/articles/cross-server-messaging
This service helps with responses between servers.

2 comments

0

not sure that's what he is aking

This discussion is preserved as it was. New answers, comments, and votes are closed.