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

How would that go in the code? Sorry i have never done this type of thing in httpservice

Add a variable HEADERS and just change up some code

...
ENDPOINT = `https://registry.rover.link/api/guilds/{GUILD_ID}/roblox-to-discord/{USER_ID}`
HEADERS = {['x-api-key'] = "API KEY"}

local response = HttpService:Get(ENDPOINT, HEADERS)
...

Apparently its a bool, unable to cast directory to a bool

Just read that HttpService:GetAsync has another parameter in between url and headers, which is nocache. You shouldn’t be worried about that, just change that line to

local response = HttpService:Get(ENDPOINT, false, HEADERS) -- false is the default value

Says unauthorized, is there a page on rover that i have to like register?

“Unauthorized” means that you do not have the permission to access the data because you are doing something that I call an “anonymous request”, basically there is no data about the program that is sending the request. Usually happens because of an invalid API key.

Try replacing x-api-key with Authorization.

Apparently this is a bad request, line 4:

   local response = HttpService:GetAsync(ENDPOINT, false, HEADERS)

Heres my code:


game.Players.PlayerAdded:Connect(function(Player)
    local HttpService = game:GetService("HttpService")

    local ENDPOINT = `https://registry.rover.link/api/guilds/1170387953936257034/roblox-to-discord/{Player.UserId}`

    local HEADERS = {['Authorization'] = "n"}

    local response = HttpService:GetAsync(ENDPOINT, false, HEADERS)
    local data = HttpService:JSONDecode(response) 
    print(data)
end)

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