#Player info script only loads my image

1 messages · Page 1 of 1 (latest)

winged dome
#

ive set a client -> server -> client system to gather all the players into a list layout, and it works for their usernames and nicknames. however, the thumbnail function doesnt and it always loads my avatar for some reason

#

script for reference:

local plrs = game.Players

local user
local nick

local pc = game:GetService("UserInputService").MouseEnabled

repeat wait() until script.Parent.Parent.Name == "PlayerFrame"

game:GetService("ReplicatedStorage").PlayerIcon2.OnClientEvent:Connect(function(plr, voting)
    user = plr.Name
    nick = plr.DisplayName
    local playericon = plrs:GetUserThumbnailAsync(
        plr.UserId,
        Enum.ThumbnailType.HeadShot,
        Enum.ThumbnailSize.Size150x150
    )
    script.Parent.ImageLabel.Image = playericon
end)```
limber charm
#

i didnt get what you trying to do

winged dome
#

piggy player list

limber charm
#

you want all player thumbnails?

winged dome
limber charm
#

then why dont just loop through players?

#

and have event for when player join and leaves

winged dome
#

what

#

would that be on the server script?

limber charm
#

client

winged dome
#

also why does it load player info correctly but not the thumbnail

gilded bluff
#

lowk just ask ai

winged dome
gilded bluff
#

he's valid

#

and he explains well

winged dome
#

who is he

cyan garnet
winged dome
#

why are you using he/him for an inanimate object

#

anyways

#

i printed the parameters

#

turns out it prints my user twice

#

that means soemhow there's a fixed parameter and a flexible parameter? idk

cyan garnet
#

What you wrote:
game:GetService("ReplicatedStorage").PlayerIcon2.OnClientEvent:Connect(function(plr, voting)

This is on the client, so:

The first parameter plr is not actually the target player.
Roblox does not automatically pass arguments like that to each player unless you explicitly do it from the server.
You're probably receiving your own info, or the event is only firing on your own client, always using your own plr value.

Solution


game:GetService("ReplicatedStorage").PlayerIcon2.OnClientEvent:Connect(function(userId, username, displayName)
    local playerIcon = plrs:GetUserThumbnailAsync(
        userId,
        Enum.ThumbnailType.HeadShot,
        Enum.ThumbnailSize.Size150x150
    )
    
    local playerFrame = script.Parent --IF its your UI template
    playerFrame.ImageLabel.Image = playerIcon
    playerFrame.Username.Text = username
    playerFrame.DisplayName.Text = displayName
end)```
#

@winged dome