Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I spawn an image of the player for every player in the game?

Asked by 4 days ago
Edited 4 days ago

When a player joins, I'm trying to get it to spawn an image of every other player but I can't get it to work. Why? This is what I'm doing.

game.Players.PlayerAdded:Connect(function(plr)
    game.ReplicatedStorage.Events.PlayerJoined:FireAllClients(plr)
    for i, v in pairs(game.Players:GetChildren()) do
        if v.userId ~= plr.userId then
            local plrImage = Instance.new("ImageLabel")
            plrImage.Parent = script.Parent.LeaderboardFrame
            plrImage.Name = plr.Name

            plrImage.Image = game.Players:GetUserThumbnailAsync(v.userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
            plrImage.BackgroundColor3 = Color3.new(200, 255, 180)
            plrImage.Size = UDim2.new(0, 100, 0, 100)
            plrImage.AnchorPoint = Vector2.new(0.5, 0.5)
            plrImage.Position = UDim2.new(-2.615, 0, 0.995 - (0.02 * v.QuestionsAnswered), 0)
            plrImage.Name = v.Name
            plrImage.Parent = plr.PlayerGui.ScreenGui.LeaderboardFrame
        end
    end
end)

Answer this question