How to get a error on a http request

I’m trying to find a way to see if there is an error in the http request but I can’t

game.ReplicatedStorage.Events.JoinedEvent.OnServerEvent:Connect(function(Player,Lplayer)
	local http = game:GetService('HttpService')
	while true do
		wait()
		local response = http:RequestAsync({
			Url = 'https://api.romanager.bot/v1/discord-roles/'..Lplayer.UserId,
			Method = 'GET',
			Headers = {
				['Authorization'] = 'i-dont-show-my-api-key'
			}
		})
		if response["Body"]["name"] then
			script.Parent.Text = "You are in the server!"
		else
			script.Parent.Text = "you are not in the server!"
		end
	end
end)

Did you test it?
If yes, is there an error in the console?

yea but is saying you are not in the server

Maybe put a print statement to see the result? And also put a delay so you dont get rate limited

The data is a JSONEncoded string not a dictionary. That’s why your code isn’t functioning as it should. If you decode the response before processing it the issue should be fixed(unless there are other issues as well, such as the response format being different or the API request being done incorrectly, etc):

--this function receives a JSON-encoded string and returns a dictionary
local data = http:JSONDecode(response)

if data["Body"]["name"] then
	script.Parent.Text = "You are in the server!"
else
	script.Parent.Text = "you are not in the server!"
end