Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to pick random player and get his picture?

Asked by 4 years ago
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
0
Where is this script executing? Is it in the server? IStarConquestI 414 — 4y
0
game.StarterGui.ScreenGui.ImageLabel This is local script ArtemVoronin0 171 — 4y
0
What exactly is going wrong with it? Is it printing out an error or what? IStarConquestI 414 — 4y
0
Error: Unable to cast token to token ArtemVoronin0 171 — 4y
0
There's no information in what line I make something wrong. ArtemVoronin0 171 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

GetUserThumbnailAsync() takes ThumbnailType as its second argument and ThumbnailSize as its third. You have them switched.

0
Thanks you. ArtemVoronin0 171 — 4y
Ad

Answer this question