Hey! So im working on a game, and i want to grab the amount of players in a game in that specific universe, and make it show up on the text label. Here is an example of a picture.
here is the script. I would be grateful if anyone can help me modify this script to work:
function players_online(place_id)
local web = game.HttpService:GetAsync("https://www.rprxy.xyz/games/"..place_id)
local player_text = string.find(web,"Playing") -- find the online players section
local new = string.sub(web,player_text)
local number_start = string.find(new,">") -- find where the number starts
new = string.sub(new,number_start)
local number_end = string.find(new,"<") -- find where the number ends
new = string.sub(new,2,number_end-1)
local players_online = string.gsub(new,",","") -- in case it's over 1000 players
return tonumber(players_online)
end
while wait(0.01) do
local web = game.HttpService:GetAsync(“https://www.rprxy.xyz/games/”…place_id)
local player_text = string.find(web,“Playing”) – find the online players section
local new = string.sub(web,player_text)
local number_start = string.find(new,">") -- find where the number starts
new = string.sub(new,number_start)
local number_end = string.find(new,"<") -- find where the number ends
new = string.sub(new,2,number_end-1)
local players_online = string.gsub(new,",","") -- in case it's over 1000 players
return tonumber(players_online)
script.parent.text = "Players : "..new
Unfortunately I didn’t, but I’m currently looking for a solution to modify this. “I would be grateful if anyone can help me modify this script to work”
Okay. How do you think I can make this script successful in grabbing the amount of players from another game to show up on the gui in the same universe?
while wait(0.01) do
local web = game.HttpService:GetAsync("https://www.rprxy.xyz/games/"..place_id)
local player_text = string.find(web,"Playing") -- find the online players section
local new = string.sub(web,player_text)
local number_start = string.find(new,">") -- find where the number starts
new = string.sub(new,number_start)
local number_end = string.find(new,"<") -- find where the number ends
new = string.sub(new,2,number_end-1)
local players_online = string.gsub(new,",","") -- in case it's over 1000 players
return tonumber(players_online)
script.parent.text = "Players : "..new
function players_online(place_id)
local web = game.HttpService:GetAsync("https://www.rprxy.xyz/games/"..place_id)
local player_text = string.find(web,"Playing") -- find the online players section
local new = string.sub(web,player_text)
local number_start = string.find(new,">") -- find where the number starts
new = string.sub(new,number_start)
local number_end = string.find(new,"<") -- find where the number ends
new = string.sub(new,2,number_end-1)
local players_online = string.gsub(new,",","") -- in case it's over 1000 players
return tonumber(players_online)
end
while true do
print(players_online(000000))
wait(6)
end