GetUserThumbnailAsync for NPCS? Is it possible?

Hello!
Is there any way I can get something simmilar to the “AvatarBust” effect but with an NPC.

I want a function that I can give a model of an npc and will get back some form of useable image. I would most likely have to use viewport frames most likely though but I am not great with them.

Issue:
To my knowledge there is no ability to do this in a Roblox

I have looked for articles or questions on this. I know that I can render the Character in blender (something which I have done in the past) but I want something more automatic as that will save labour for me

Not sure if this is the correct category for this, if someone could point me in the right direction that would be great,
Thanks!

1 Like

If it wouldn’t bother you, can you explain what this “AvatarBust” is? I am very unfamiliar with that word and there are multiple meanings and depictions.

Sure thing.

When using the “GetUserThumbnailAsync()” function you have to specify afew parameters, one of which is “Enum.ThumbnailType”. There are 3 types of ThumbnailType, “AvatarThumbnail” which is the full body, “HeadShot” which is mostly all head and “AvatarBust” which is the upper body and head.

There is more on GetUserThumbnailAsync on the article about it.

You can use ViewportFrames and position the NPC and/or Camera to create the ‘bust’ effect.

If you’re having trouble learning how to position the camera to create the bust effect, make sure to position it using Point.CFrame.LookAt which will give you a unit vector in the front direction of the point (like Head), then you can multiply it. Point.CFrame.LookAt * 3 will move the camera 3 studs in front of the character’s Head. Then you can use CFrame.lookAt to have the camera face back at the character.


Here’s a tutorial on how to use them:

5 Likes

Having trouble with the CFrame.LookAt, I tried camera.CFrame = npcClone.Head.CFrame.LookAt * 3 which gave the error " LookAt is not a valid member of CFrame ".

Not sure how to format it

It is CFrame.LookVector. CFrame.lookAt() is a constructor, while CFrame.LookVector is a property.

Still unsure on formatting. I have camera.CFrame = npcClone.Head.CFrame.LookVector * 3 which gives the error "Players.Devfine.PlayerScripts.HackPlayers:79: invalid argument #3 (CFrame expected, got Vector3) "

You’re trying to set the CFrame value as a Vector3 value (CFrame.LookVector).

Try something more like this…

local Offset = npcClone.Head.CFrame.LookVector * Distance
camera.CFrame = CFrame.lookAt(
    npcClone.Head.Position + Offset,
    npcClone.Head.Position
)
5 Likes