How can I connect my discord server and my roblox game using rover?

Can you send what it printed? Also, is this an error or the output of print?

Move local HttpService = game:GetService("HttpService") outside of the function. It won’t really matter but it will look much better.

This is a output of JSONDecode

HTTP 400 (Bad Request)
Stack Begin
Line 8 ← My bad, this is the getasync
Stack End

Print response before you will JSONDecode the request. It must output the error message.

My bad i meant the GetAsync part

Maybe change Authorization to auth? I have no clue what the header must be due to RoVer’s poor documentation.

On an old depracted post, it said “Authorization” thats if you wanna see the article right here

Isn’t it HEADERS.Authorization?

Try doing

HEADERS = {
  ["Authorization"] = "Bearer API-KEY"
}

Okay that worked. it printed a table in what seems to start with 0x. isnt that the wait to get hex colors in json? anyways
How do we get to the part of checking if the player is in the server and verified?

complete banana shock

Anyways, now can you send what it got in the second print after the JSONDecode part?

I mean in the Output window in Studio.
Снимок экрана 2023-11-14 202639

No, it’s a hex value. In programming, hex starts with 0x. In Studio, hex is used to reffer to tables and Instances in client’s memory.

  13:28:57.436   ▼  {
                    ["discordUsers"] =  ▼  {
                       [1] =  ▼  {
                          ["deaf"] = false,
                          ["flags"] = 0,
                          ["joined_at"] = "2023-11-04T15:43:53.077000+00:00",
                          ["mute"] = false,
                          ["pending"] = false,
                          ["roles"] =  ▶ {...},
                          ["user"] =  ▼  {
                             ["avatar"] = "6da5f421cdc2512fa0b2a821977ed4cc",
                             ["discriminator"] = "0",
                             ["flags"] = 128,
                             ["global_name"] = "mach",
                             ["id"] = "511477487620849665",
                             ["premium_type"] = 0,
                             ["public_flags"] = 128,
                             ["username"] = "symewrtw"
                          }
                       }
                    },
                    ["guildId"] = "1170387953936257034",
                    ["robloxId"] = 131504927
                 }  -  Server - Script:14

data["discordUsers"] is what we are looking for. For your problem, we can simply check the length of it since we only need to know if anyone is authorized under that account.

if #data["discordUsers"] > 0 then
  print("authorized")
else
  print("not authorized")
end

To check if the code is working, input USER_ID as 1. It should print “not authorized”.

Attempt to get the length of a NIL value

oopsie doopsie replace response with data

1 Like

Thanks for spending almost half an our helping me, much love.
How can I check if a player has a certain role? theres a property in discordusers under the value 1 named [“roles”] and each role has a id marked under a number value order

1 Like

Those number value orders are discord role IDs. Let me quickly check how to get them

Nono its like a table like this heres an example of how it looks

["dscusers"] = { [1] = ["roles"] = [1] = "roleid"

Yeah, it’s the discord role ID.
In discord settings, enable Developer Mode (in App Settings → Advanced).
Go in your server settings, find the role you will need to check for, and click those 3 dots. There will be a button to copy role ID.