So I want to know how could I get a JobId from a server using the server list like this one:
I want to be able to choose a server and get the job id with javascript or something, is it possible?
So I want to know how could I get a JobId from a server using the server list like this one:
I think, this is the Job Id of the server:
It maybe incorrect as this is string which is formatted like Job Id and its accessable through Inspect Element, but i think the only way to get the Job Id is by printing the game.JobId
.
Like the previous guy mentioned:
local jobId = game.JobId
print("JobId: "..jobId)
You can even use the JobId to teleport players to a specific server with the Idβ¦
local teleportService = game:GetService("TeleportService")
local jobId = .. -- id of the server you would like the player to teleport to..
-- Teleport the player to the specified server
teleportService:TeleportToPlaceInstance(game.PlaceId, jobId)
JobId allows developers to manage game servers and perform server sided operations, devs can use the JobId to monitor servers performance, track player data, and perform other server sided tasksβ¦
Thanks man for the information. However, Iβm trying to get JobIds from servers of games I dont own. Thatβs why I was trying to do so with server list on Roblox page.
You need to use the games api. Docs: Swagger UI
Example in Node.js:
const axios = require('axios');
async function get(placeid){
const response = await axios.get(`https://games.roblox.com/v1/games/${placeid}/servers/0?sortOrder=2&excludeFullGames=false&limit=100`)
//sortOrder: 1 - min-max players, 2 - max-min players
//limit - the number of results per request. (ONLY 10, 25, 50, 100)
if(response && response.data && response.data.data){return response.data.data}
return
}
(async() => {
var servers = await get(7180042682)
console.log(servers[0].id) //print 53511917-d9dc-4dcb-b663-ecd62da96836
})()
It will only give you the first 100 servers (or whatever you want), to get more you need to use cursor
. response.data
has the values ββpreviousPageCursor
and nextPageCursor
(if one or two of them are null, then you cannot go to the next/previous page). You need to add them when requested and the link will be something like this https://games.roblox.com/v1/games/7180042682/servers/0?sortOrder=2&excludeFullGames=false&limit=100&cursor=eyJzdGFydEluZGV4IjoxMCwiZGlzY3JpbWluYXRvciI6InBsYWNlSWQ6NzE4MDA0MjY4MnNlcnZlclR5cGU6MCIsImNvdW50IjoxMH0KYzliYTlmZmQzMTNhNmQzNDNkMGJhOWUzZTMzZWE3ZWE0NTE1ZWNlNGE0ZmE1MWQ5YzU4MGNjNTRhNDZlMDkwYQ%3D%3D
.
If you have questions - ask.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.