RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a text button that shows how many players are playing in a different game place."
-- Local Script inside the TextButton local textButton = script.Parent local HttpService = game:GetService("HttpService") local placeId = 123456789 -- Replace with the Place ID of the game you want to check local url = "https://games.roblox.com/v1/games/" .. tostring(placeId) .. "/servers/Public?sortOrder=Asc&limit=10" local function updatePlayerCount() local success, response = pcall(function() return HttpService:GetAsync(url) end) if success then local data = HttpService:JSONDecode(response) local totalPlayers = 0 for _, server in ipairs(data.data) do totalPlayers = totalPlayers + server.playing end textButton.Text = "Players in game: " .. totalPlayers else textButton.Text = "Error fetching player count" end end updatePlayerCount() while true do wait(60) -- Update every minute updatePlayerCount() end