Hello,
I have written this script to check if a player is verified in my discord server, and if so change an image id to one that is verified, but the problem is that i keep getting error 404 (not found) , which suggets that my api link is wrong. I looked on the official documentation and I could not find any extra information:
Script:
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local API_KEY = "hidden"
local BASE_URL = "https://registry.rover.link/api"
local ROBLOX_ID
local imageObject
local verifiedImageId = "17640414798"
local defaultImageId = "17640427928"
local headers = {
["Authorization"] = "Bearer " .. API_KEY
}
Players.PlayerAdded:Connect(function(Player)
local PlayerId = Player.UserId
local PlayerGui = Player:WaitForChild("PlayerGui")
local DCVerified = PlayerGui:WaitForChild("HubUI"):WaitForChild("MainFrame"):WaitForChild("NameContainer"):WaitForChild("DCVerified")
ROBLOX_ID = PlayerId
imageObject = DCVerified
local function requestWithRetry(url, headers, maxRetries)
local attempt = 0
while attempt < maxRetries do
local success, response = pcall(function()
return HttpService:GetAsync(url, true, headers)
end)
if success then
return response
else
warn("HTTP request failed (attempt " .. attempt+1 .. "): " .. response)
attempt = attempt + 1
task.wait(2)
end
end
return nil
end
local function checkVerification()
local endpoint = BASE_URL .. "/roblox-to-discord/" .. ROBLOX_ID
local response = requestWithRetry(endpoint, headers, 3)
if response then
local data = HttpService:JSONDecode(response)
if data and data.discordId then
local discordId = data.discordId
local verifyEndpoint = BASE_URL .. "/discord-to-roblox/" .. discordId
local verifyResponse = requestWithRetry(verifyEndpoint, headers, 3)
if verifyResponse then
local verifyData = HttpService:JSONDecode(verifyResponse)
if verifyData.verified then
imageObject.Image = "rbxassetid://" .. verifiedImageId
else
imageObject.Image = "rbxassetid://" .. defaultImageId
end
else
warn("Verification request failed after retries.")
imageObject.Image = "rbxassetid://" .. defaultImageId
end
else
warn("Discord ID not found for Roblox user.")
imageObject.Image = "rbxassetid://" .. defaultImageId
end
else
warn("HTTP request failed after retries.")
imageObject.Image = "rbxassetid://" .. defaultImageId
end
end
checkVerification()
end)
Any help would be appreciated, thanks!