Ad
Log in to vote
0

I need help with a player avatar gui image???

Asked by 17 days ago

My error is at line 10 and 9. I am trying to show the player avatar on a gui shown to all players. My error in the output is "Nil" and I believe it is the print function. but it is caused by line 10

local pic = script.Parent

local player1 = game.ReplicatedStorage.heist1Values.Player1.PlayerName
print(player1.Value)

while wait(0.1) do

    if player1.Value ~= "none" then
        local player = game.Players:GetChildren(player1.Value)
        print(player.DisplayName)
    --local player = game.Players.LocalPlayer

if player.Name == player1.Value then

local userId = player.UserId

local thumbType = Enum.ThumbnailType.AvatarBust

local thumbSize = Enum.ThumbnailSize.Size420x420

local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)





            pic.Image = content
            end
    end
end

1 answer

Log in to vote
0
Answered by 17 days ago

Tried it in studio and it works like that

local pic = script.Parent.pic

local player1 = game.ReplicatedStorage.heist1Values.Player1.PlayerName
print(player1.Value)



while wait(0.1) do

    if player1.Value ~= "none" then
        local player = game.Players:FindFirstChild(player1)
        print(player.DisplayName)
        --local player = game.Players.LocalPlayer

            local userId = player.UserId

            local thumbType = Enum.ThumbnailType.AvatarBust

            local thumbSize = Enum.ThumbnailSize.Size420x420

            local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)





            pic.Image = content
    end
end

keep in mind its modified a little so if there is something i have missed tell me

0
okay lemme see if it works now Lamborghinihurican0 4 — 17d
0
tysm Lamborghinihurican0 4 — 17d
0
Accept the answer if it works :) VAnkata20 49 — 17d
0
sorry thought I accepted it Lamborghinihurican0 4 — 13d
Ad

Answer this question