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

How can I make a screenGui that will display the players username and a picture of their avatar?

I am working on a FPS game and i am trying to make a screenGui that will display a players health and a picture of their avatar.

I havent tested any code because i am completely lost on this. Any help would be greatly appreciated. Thank you.

1 answer

✓ Accepted answer

Not a script request site. But will give it to ya anyways.

local label = script.Parent.TextLabel -- your text label you want to show the name in
local image = script.Parent.ImageLabel -- your image label you want to show the picture in
local Players = game:GetService("Players") --the players service

--fetch the thumbnail
local userId = game.Players.LocalPlayer.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

label.Text = game.Players.LocalPlayer.Name -- changes the text label's text to the player's name
image.Image = content --changes the imagelabel's image to be the headshot image

Put inside a LocalScript inside a ScreenGui with a TextLabel and a ImageLabel. ~Dan_PanMan, experienced scripter.

1 comment

0

Thanks Dan_PacMan!

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