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

How to pick random player and get his picture?

local Players = game:GetService("Players")
local GetPlayers = game.Players:GetPlayers()
local localPlayer = GetPlayers[math.random(1, #GetPlayers)]
local UserId = localPlayer.UserId
local ThumbnailSize = Enum.ThumbnailSize.Size420x420
local ThumbnailType = Enum.ThumbnailType.HeadShot
local content = Players:GetUserThumbnailAsync(UserId, ThumbnailSize, ThumbnailType)
local Image = script.Parent
Image.Image = content

5 comments

0

Where is this script executing? Is it in the server?

0

game.StarterGui.ScreenGui.ImageLabel This is local script

0

What exactly is going wrong with it? Is it printing out an error or what?

0

Error: Unable to cast token to token

0

There's no information in what line I make something wrong.

1 answer

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