I am trying to make a GUI where you can type in a players username and then it will change a imageLabel (Which is on a part) to the specific player's AvatarThumbnail hope that made sense. The part is known as ContestantBoard because it is an mage of the contestant. Here is my script:

local button = script.Parent -- The button this is in
local ContestantBoard = -- The part with the ImageLabel game.Workspace.ContestantPhotos:WaitForChild("ContenstantPhoto1") 
local Players = game:GetService("Players")
button.MouseButton1Click:Connect(function()
	local username = script.Parent.Text -- 'Text' is the name of the TextBox where you write the username
		local plr = Players:FindFirstChild(username)
		if plr then
			local userId = plr.UserId
			local thumbType = Enum.ThumbnailType.AvatarThumbnail
			local thumbSize = Enum.ThumbnailSize.Size420x420
			local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
			local imageLabel = ContestantBoard.SurfaceGui:WaitForChild("ImageLabel")
		end
end)

I hope I explained everything well. Thank you in advance.

1 comment

0

you need to get the thumbnail in a pcall(function()