How can I bypass the user thumbnail caching?

Hello. I have a script that uses game.Players:GetUserThumbnailAsync to automatically put pictures of users in their respective offices.

This works fine upon game initialization, HOWEVER, it does not update every 90 seconds as it is supposed to.

I have verified that my code is functional, and that the issue is not on my end. I believe that the reason it does not update when I change my avatar is because the game caches the thumbnail, and then re-uses it instead of fetching a new one.

How can I remove this caching mechanism, so that the image is always up-to-date? If this is even possible?

Looks like the caching is on the method itself so you’ll have to find a different way of getting the thumbnail. Personally I don’t think the cache is bad and I’d prefer it in favour of another method. I try to use in-engine methods whenever possible.

A non-caching solution I found is making an Http request to the thumbnails API. Tested in Studio by roughly fetching my account’s thumbnail before and after changing my outfit and it returned a different image link each time, so safe to say that works out.

(Thumbnails API)

I used the /v1/users/avatar-headshot endpoint to get a headshot of my avatar. Test code I employed is as follows. To test for yourself: replace the last userId with your own (it’s a CSV so you can batch-request multiple users’ thumbnails), paste it in Studio and check the imageUrl, change your avatar and then run it again, then compare the imageUrl between when you first ran the code and afterwards.

local http = game:GetService("HttpService")
local url = "https://thumbnails.rprxy.xyz/v1/users/avatar-headshot?format=Png&isCircular=false&size=48x48&userIds=6809102"

local resp = http:JSONDecode(http:GetAsync(url)).data
for _, userThumbData in ipairs(resp) do
	print(userThumbData.imageUrl)
end
1 Like