Better way for live updating avatar?

Hi!
My current Avatar Updater script does not really update very fast.
I have tried multiple outfits, and none of them seem to update. About 10 to be exact.
My script:

while task.wait() do 
	print("Changed")
	script.Parent.Image = "https://www.roblox.com/bust-thumbnail/image?userId=133017837&width=420&height=420&format=png"
	task.wait(50)
	warn("Change inbound! (5 seconds)")
	task.wait(5)
end

Video:
https://streamable.com/sda2qz
How could this be improved?
Thanks!
(My screen recorder is trash and corrupted some of it, the thing where my avatar was dragged in Edge was my profile, showing that Roblox was updating it.)

1 Like

Still as of right now (10 changes), It’s not updating.
image
(2) Profile - Roblox
(my profile takes a while to load, so i dont wanna go to it)

I think your problem is that avatar thumbnails take days to update, you’ll have to use a viewport frame and put the character there.

It updated to the FNF BF from my normal avatar this afternoon, back and fourth twice, and now it’s stuck. I’m also not very experienced with viewport frames.

My co scripter also notified me of the GetThumbnailAsync function, but the last post on it was in 2019. This does not work.

local success, image, ready = pcall(Players.GetThumbnailAsync, Players, UserId, Enum.ThumbnailType.AvatarThumbnail)

Dont know if they just thanos snapped it from the engine or what…

Before what would have happened is that your avatar thumbnail would become [content deleted] before Roblox would redraw the thumbnail every few days, however nowadays your thumbnail will just remain the same from when it was before you changed it (I think).

For viewport frames, they are a bit laggier but they update immediately, also there is a separate problem your likely running into and that is image caching, after an image is downloaded, Roblox won’t redownload it despite the fact it changed.

It’s part of game.Players you can view it there.

So would the answer be jsut duplicating it? It would still use the image, but it would be forced to redownload it.

This code

local Players = game:GetService("Players") -- Canonical way to get a service

-- Simplified pcall
local success, image, ready = pcall(function ()
    return Players:GetUserThumbnailAsync(133017837, Enum.ThumbnailType.AvatarThumbnail) -- OP requested avatar
end)

-- Direct pcall (preferable, as it does not create an anonymous function)
local success, image, ready = pcall(Players.GetThumbnailAsync, Players, 133017837, Enum.ThumbnailType.AvatarThumbnail)

if success then
    if ready then
        while task.wait() do
            script.Parent.Image = image
        end
    else
    warn("Image not ready!")
    end
else
    warn("Call failed!")
end

Fails at line 9.

It won’t redownload it as it is saved to cache the only way to redownload the image is to leave and rejoin.

How could I do it in a viewport then?

First create an ViewPortFrame and replace the ImageLabel with it, then insert a basic Dummy in the ViewPortFrame, you should also add a part called ‘cam’ and position (and orientate) it so it looks at where you wish the character to be shown at (looking at the head)

You would get the character’s current outfit through:

local Humanoid = --Path To Dummy's Humanoid
game.Players:GetHumanoidDescriptionFromUserId([UserId])
Humanoid:ApplyDescription(humanoidDescription)

Then in order to show the head of the character in a localscript inside the ViewPortFrame do the following:

local cam = Instance.new('Camera')
cam.Parent = script
script.Parent.CurrentCamera = cam
local CamPart = --Path To Dummy's 'Cam' part
cam.CFrame = CamPart.CFrame
1 Like

I need to do something, I will let you know how it goes when I’m back.

Can Someone Inform On What Is task.wait I Cant Seem To Fine Any Tutorials On It.

It’s a new version of wait(), it’s more reliable and stuff.

It’s wait() but with better accuracy and it doesn’t throttle.

Interesting! And I’m Assuming In The Brackets You Put A Number To Wait.

1 Like

Yep, it works exactly just like wait() without the throttling.

Thanks For The Information! I Didn’t Know!

2 Likes

image
Seems to just do this.