Getting "HttpService can't access ROBLOX resources" when trying to use a webhook

I made a gui that asks the user for a Discord webhook to during the setup. This then gets stored in a datastore. I was testing it and when I tried to post a message using the PostAsync function of HttpService, it threw that error, have any ideas on how to fix this?
This is the code for the script

local HttpsService = game:GetService("HttpService")
local dbs = game:GetService("DataStoreService")
local isWhitelisted = dbs:GetDataStore("")
local webhook = isWhitelisted:GetAsync("")
local Remote = script.Parent.Parent.Parent.Remotes.Test

Remote.OnServerEvent:Connect(function(user, username)
	local data = {
		content = "This is a test!"
		username = user.Name;
		avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId=" .. user.UserId
	}
	HttpsService:PostAsync(webhook, HttpsService:JSONEncode(data))
end)

I deleted the datastore names since I don’t think you need those, if you do, I’ll be happy to edit them in.

You cannot access roblox.com through HTTP at all.

You can’t use roblox.com as HttpService doesn’t allow you to use ROBLOX domain.

Instead use a proxy, kind of like a mid server if you will. You can use this rprxy.xyz, you can also use your own website to work as a proxy but it’s more complicated and there will obviously be more steps towards it.

Hopes this solves your problem.

@zachariapopcorn Are you trying to put the webhook profile picture as the player’s avatar? If so, this post may help you. How to get Profile Icon?

1 Like

So, using data stores is using the roblox.com domain? I was able to use it just fine without data stores and no error would be thrown.

No, you are trying to access roblox.com at the line:

avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId=" .. user.UserId

And Roblox does not allow that

You’re trying to access HttpService using roblox.com, which you cant. Because it’s blocked by ROBLOX.

Wrong ~

avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId=" .. user.UserId

You can bypass these by using a proxy. And a common one that it used and that does work is rprxy.xyz, give it a try it’ll most likely work.

Correct ~

avatar_url = "http://www.rprxy.xyz/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId=" .. user.UserId

You can also give this one a look as it’ll help u set one up if you want.

3 Likes

Thanks! I changed the URL to the one you linked above and it worked!

1 Like