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

How to make an image of the player who joined at the top of the screen, kind of like in arsenal?

When I try to add the image, the image doesnt appear but it is getting created, here is my script:

game.Players.PlayerAdded:Connect(function(plr)
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size150x150
	local playerThumbnail = game.Players:GetUserThumbnailAsync(plr.UserId, thumbType, thumbSize)
	
	local newImage = Instance.new("ImageLabel", game.StarterGui.Leaderboard.Frame)
	newImage.Name = plr.Name.."Image"
	newImage.Position = UDim2.new(0.5, 0, 0.5, 0)
	newImage.Size = UDim2.new(0, 150, 1, 0)
	newImage.AnchorPoint = Vector2.new(0.5, 0.5)
	newImage.Image = playerThumbnail
end)

1 answer

When you put things in StarterGui before clicking Play (With Player), it will immediately replicate to the PlayerGui. The PlayerGui is the reason the player sees the GUI to begin with. So instead of using the StarterGui, you need to put it in the PlayerGui.

game.Players.PlayerAdded:Connect(function(plr)
    local thumbType = Enum.ThumbnailType.HeadShot
    local thumbSize = Enum.ThumbnailSize.Size150x150
    local playerThumbnail = game.Players:GetUserThumbnailAsync(plr.UserId, thumbType, thumbSize)

    local newImage = Instance.new("ImageLabel")
    newImage.Parent = plr.PlayerGui
    newImage.Name = plr.Name.."Image"
    newImage.Position = UDim2.new(0.5, 0, 0.5, 0)
    newImage.Size = UDim2.new(0, 150, 1, 0)
    newImage.AnchorPoint = Vector2.new(0.5, 0.5)
    newImage.Image = playerThumbnail
end)

3 comments

0

also, don't use the 2nd parameter of Instance.new() as it is deprecated and slow.

0

OMG thank you so much! :D

0

Mark it as the answer then.

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