I’m trying to make a friend join UI, where it displays all of your friends who are in your game which lets you join them as well.
I already know how to do all of that, but I also want to display some miscellaneous data such as server region and player count (of the server that said friend is in), but I’ve found no way to do that.
I’m just looking for a function or method that either retrieves the DataModel of said server or some info about it.
This website will get the server IP not yours, but if you visit this url from your brower then it will get your IP.
Heres an little example on how you do it.
local ip_website = "http://ip-api.com/json/"
local httpservice = game:GetService("HttpService")
local response = httpservice:GetAsync(ip_website)
if response then
Now to get the player count of the server you can easily do
The :GetPlayers() returns a table of all the players in the server, and if you put # (hashtag) in front of any table then it will return how many items there are in a table.
If there are 4 players in a server and if i do
local playersList = game.Players:GetPlayers()
local playersAmount = #playersList
print(playersAmount) -- Prints 4