Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to get a local player's avatar and put it on a decal?????

So I did some research to see if I could find a script that would get the players avatar and change the image to it. I found this script which doesn't work, I put a local script in a decal tell me if this is wrong.

wait(0.1)
script.Parent.Image = "http://www.roblox.com/thumbs/avatar.ashx?x=352&y=352&format=png&username="..game.Players.LocalPlayer.Name

1 comment

0

I dont think this logic is possible, if theres no search on the developer hub then its impossible to do. Only option is to use :getuserthumbnailaysnc

1 answer

you can do the function :GetUserThumbnailAsync(), i dont know much about it the code below is from the wiki

local Players = game:GetService("Players")
 
local player = Players.LocalPlayer
 
-- Fetch the thumbnail
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
 
-- Set the ImageLabel's content to the user thumbnail
local imageLabel = script.Parent
imageLabel.Image = content

you can read more about it at https://developer.roblox.com/en-us/api-reference/function/Players/GetUserThumbnailAsync

6 comments

0

Thanks but I wasn't looking for how to put a player's avatar on a imagelabel. However I modified it to make it "work" woth the decal, sadly It didn't work :c

0

oh, i thought u wanted the avatar because if you click the link it shows you the full body avatar

0

wait hang on i didnt read the decal part looooooooooool, ill try to look for a solution for u

0

thanks!

0

solution found?

0

no

This discussion is preserved as it was. New answers, comments, and votes are closed.