HTTP Service Error

Hello. I’m using the HttpService for the first time and I don’t know why this isn’t working. I am trying to get the friends count of someone but it doesn’t work and throws up an error. Here’s my code

local HttpService = game:GetService("HttpService")

local function getFriendsCount(userId)
	local httpResponse = HttpService:GetAsync("https://friends.rprxy.xyz/v1/" .. userId .. "/friends/count")
	local decoded = HttpService:JSONDecode(httpResponse)
	return decoded
end

local response = getFriendsCount(game.CreatorId)

Did you enable Http Requests from the Game settings? Also if that link doesn’t work, you could try this

"http://friends.rprxy.xyz/v1/users/"..userId.."/friends/count"
2 Likes

Please provide the error that it threw.

The error is: HTTP 404 (Not Found)

In game, you’re getting this error?

That worked, thank you! :slight_smile:

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

1 Like