Checking if a Group is locked or not

So, I got the group from its id, then I want to check if its locked or not, is there any way to check whether its locked or not?

Honestly, I don’t really have a problem, I just want to know how to do so if it is even possible.

I’ve been searching on google, have found nothing but a property of GroupService “RobloxLocked” no idea what to do with that though.

Don’t really got a code right now, well I do but it’s very short and nothing worth showing as there’s nothing that needs to be fixed in the code.

For the record, I don’t want you writing me code, I just want to know if there’s any article on the topic?

Send a [GET] request to this url https://groups.roblox.com/v1/groups/{groupId}

You have to make your server, I recommend you to use Heroku to host your website.
I know node.js so ill give you an example fetching group info using node js.

How to create a simple server with node js using express? - Youtube

perfect you’ve created a server!
Now install node-fetch
using npm install node-fetch
When its installed, require it in your app.

const fetch = require('node-fetch')

Now to get the group info do

const response = await fetch(`https://groups.roblox.com/v1/groups/${groupId}`,{method: 'GET'});

Good! you now got the group info you needed! but… how did we get the group id that i’ve mentioned in url? :thinking:
Don’t worry! keep reading.

Now lets join up our whole javascript code.

const express = require('express');
const fetch = require('node-fetch');

const app = express()

app.get('/groupInfo/:id', async (req,res) => {
    if (req.params) {
     if (req.params.id) {
            var groupId = req.params.id
            const response = await fetch(`https://groups.roblox.com/v1/groups/${groupId}`,{method: 'GET'});
            if (!response) { res.send('No response') return }
            res.json(response)
       }
    }
})

app.listen(3000, () => {
     console.log("Server is started at port 3000.")
});

perfect! now host your app on heroku
How to host your node js application on heroku - Youtube

Now get your website url appname.herokuapp.com
Now use HttpService to get the group info.

local httpservice = game:GetService("HttpService")

Now get the response using httpservice:GetAsync()

local res = httpservice:GetAsync("appname.herokuapp.com/groupid")

Now you will get the response in JSON
to convert JSON into a table you have to use HttpService:JSONDecode()

perfect now you got the group info! we are almost done.
To check if group is locked or not you have to do

res.publicEntryAllowed

if its true then its mean group is not locked, if its false then its locked.

if res.publicEntryAllowed then
   print("Group is not locked")
else
    print("Group is locked")
end

Now joining the code together!

local httpservice = game:GetService("HttpService")
local groupId = "0000000"
local website_url = "appname.herokuapp.com"

local response
local success,errorr = pcall(function()
	response = httpservice:GetAsync(website_url.."/"..groupId)
end)

if success then
	if response == "No response" then
		return error("Got no response, maybe group id is invaild?")
	end
	local info = httpservice:JSONDecode(response)
	if info.publicEntryAllowed then
		print('Group is not locked')
	else
		print('Group is locked.')
	end
else
	error(errorr)
end

Replace groupId with your group id
Replace website_url with your heroku app url.

Hope this helps!

2 Likes

Also, let me know if that wont work or you get any issue.

ok so havent read it all yet but is there any way to do this in like studio

Nope, I dont think so, thats the only method I know.

damn… ok so this is all free, right?

Yeah, heroku provides free hosting.
I’ve mentioned few youtube videos in the post.

Rather than setting up a custom proxy you can just use an existing one like RoProxy and send a request to that right?

local httpService = game:GetService("HttpService");
local url = "https://groups.roproxy.com/v1/groups/%i";
local id = 1111;

local success, res = pcall(httpService.GetAsync, httpService, url:format(id));
if not success then
    warn(res);
    return;
end

local data = httpService:JSONDecode(res);
if data.publicEntryAllowed then
    print("Group is not locked")
else
    print("Group is locked")
end

I’m curious as in to why you went ahead and built a custom proxy.

1 Like

does this work for what im tryna do?

should work, both roproxy and custom proxies are just an middleman for roblox apis, and should return the same

1 Like

yeah, forgot to put that as the solution, already implemented it into my code, thanks everyone!

1 Like

What if roproxy shuts down in future?
Its better if you make everything yourself, if roproxy shuts down somehow you still have your custom proxy that is safe and fast since your the only one who is using it.

2 Likes

oh also ive been doing some thinking theres something i need to fix in my code just cant set my finger on what, so are there any other “Properties” to data (httpService:JSONDecode(res):wink:

EDIT:

Nevermind, forgot I could just print data and get a table. Thanks once again!

Sorry this is getting a bit messy but has anyone else encountered this problem?
image