I am not so experienced with HttpService- so I guess I need a little help heh.
Can someone answer with a script that will update the members even when one joins, like on a TextLabel for example.
And explain how it works since I need to know this.
You can GET this api to get the member count, and then print the memberCount value.
Here’s an example of a request using RequestAsync:
local HttpService = game:GetService("HttpService")
local response = HttpService:RequestAsync{
Url = "https://groups.roblox.com/v1/groups/"..groupId..
Method = "GET";
Headers = {
["Content-Type"] = "application/json";
};
}
if response.Success then
print("Status code: " .. response.StatusCode .. " " .. response.StatusMessage)
print(response.Body)
else
print("The request failed: " .. response.StatusCode .. " " .. response.StatusMessage)
end
@Shyfoox Apologies, I did not realize that ROBLOX does not allow access to API’s from in-game. If you want to use the API from in-game you need to use a proxy server, or set up your own server that handle’s GET requests and returns a response body.
If you are not able to set one up/get access to one take a look at this tutorial. I cannot however guarantee that it still works though.
Alright for anyone else who looks at this thread. Yes it’s possible to get a live group member count.
This is how I did it.
local GROUP_ID = "" -- the group you want to see the live member count for
HttpService = game:GetService'HttpService'
Url = 'https://groups.rprxy.xyz/v1/groups/'..GROUP_ID -- use a proxy due to Roblox not allowing requests.
Name = HttpService:JSONDecode(HttpService:GetAsync(Url)).name -- get information
while wait(5) do
Members = HttpService:JSONDecode(HttpService:GetAsync(Url)).memberCount
script.Parent.Text = string.format('%s\' Live Member Count:\n%s', Name, Members)
end
NOTE:
You will need to enable HttpService (Allow HTTP Requests) for this to work.
Also this is an example if it was part of a TextLabel. Of course this can be changed anyway you want it to be. Members does NOT pass a integer value, if you want to use it as one use tonumber(Members).
Example usage
I hope this helps!
it works good and thank you for it