How's this GetUserThumbnailAsync not working?

Try:

local rs = game:GetService("ReplicatedStorage")
local rm = rs:WaitForChild("Remotes")
local remote = rm:WaitForChild("WinnerImage")

remote.OnClientEvent:Connect(function(plr)
	print("Connected")
	local userId = plr.UserId
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size420x420
	local content, isReady

local success, erMSG = pcall(function()
content, isReady = game:GetService("Players"):GetUserThumbnailAsync(userId, thumbType, thumbSize)
end)

	--Workspace.Lobby.LastWinner.UI.SurfaceGui.ImageLabel.Image = nil
	wait(1)
	--isReady = true
	game.Workspace.Lobby.LastWinner.UI.SurfaceGui.ImageLabel.Image = content
	print("set")
end)

I’m not sure why yo would pass the UserId through the client, just use plr.UserId

1 Like

Are there any errors in the Output window? If so, please share them.

1 Like

Nope, nothing. Let me try his solution again.

1 Like

@COUNTYL1MITS @ItsPlasmaRBLX
No errors, and not working.

1 Like

Where in the game explorer is this script located?

1 Like

I’m not sure what you’re doing wrong, the script seems to be working perfectly fine with me. Make sure it’s a server script, in ServerScriptService or Workspace.

image

local __thumbnail = game:GetService("Players"):GetUserThumbnailAsync(1, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420);

3 Likes

Huh. Saw somewhere that it should be on a LocalScript. Let me try to put it on the server.

1 Like

No, the event “onclientevent” is on the server. Make sure your code is located on the Server!

What? OnClientEvent is recieved by the server.

Can I see the corresponding FireClient() or FireAllClients() function call?

Yes, OnClientEvent is on the server, fired by a client.


:arrow_double_up: :arrow_double_up: :arrow_double_up:

https://developer.roblox.com/en-us/api-reference/event/RemoteEvent/OnClientEvent

@ItsPlasmaRBLX it states that “To listen for a message on the client, a LocalScript needs to connect a function to the OnClientEVent”

@Limited_Unique Alright, give me a moment. I’m gonna try another solution.

Clients CANNOT communicate with each other like this, this is done on the server. I’m loosing braincells over this, this should not be an 17+ reply chain.

Huh? The server is firing the event that the LocalScript receives…

Worked on the server once, let me conduct a couple more tests to see if it’s solid.

no… it does not work like that… use “OnServerEvent” if you’re doing this on the client. This was not has this post was formatted.

OnServerEvent on the client? Whatever, doesn’t matter, worked on the server. Thanks.

The script in the original post is a local script I believe. He has a server script somewhere which is calling FireClient/FireAllClients.

1 Like

I would encourage you to read up on that, I’m glad that you found the solution. I however should refer you to the post listed below due to the 2nd argument listed in the function, an exploiter can call the function with the userid “69” even though their actual userid is “420”.


The takeaway and the point of this reply is that you should try doing as much on the server as possible, rather than the client.

1 Like

Not to be facetious but the account of user ID 420 is permanently banned, jokes aside, this is a good suggestion. He could combat it by adding sanity checks, like comparing the user ID between both scripts.

1 Like