I’m using the script below to put the users headshot into an imageLabel for the game. I got this script directly from the the developer hub and I’m getting this error;
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
imageLabel.Size = UDim2.new(0, 420, 0, 420)
It’s saying that player is nil. The only time that would happen is if the environment is not the client. In other words, you’re probably running this in a normal script, which runs server-side. The server has no context for the local player. Move this code to a LocalScript and it should work fine. LocalScripts run on the client, so they have access to the LocalPlayer.