GetUserThumbnailAsync issues

I have these 2 scripts

Sever:

local Players = game:GetService("Players")

local event = game.ReplicatedStorage:WaitForChild("UpdateImage")
local createEvent = game.ReplicatedStorage:WaitForChild('CreateImage')
local removeEvent = game.ReplicatedStorage:WaitForChild("RemoveImage")

local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420

local startPart = game.Workspace:WaitForChild("Start")
local endPart = game.Workspace:WaitForChild("End")

function update()
	while task.wait(0.01) do
		for i, player in pairs(Players:GetChildren()) do
			local succes, errorMsg  = pcall(function()
				if game.Workspace:WaitForChild(player.Name).Humanoid.Health >= 0 then 
					local hrpPosition = game.Workspace:WaitForChild(player.Name).HumanoidRootPart
					local distance =  (endPart.Position - hrpPosition.Position).Magnitude
					local Gui = player.PlayerGui
					local ProgressGui = Gui.ProgressGUI
					local Frame = ProgressGui.Frame

					local newPos = UDim2.new(math.clamp(1 - (distance / 855),0,0.88))

					event:FireAllClients(player.Name, distance, newPos)

					--print(player.Name.." : ".. math.clamp(1 - (distance / 100),0,0.88))
					--Frame:WaitForChild(player.Name.."Image").Position = UDim2.new(math.clamp(1 - (distance / 100),0,0.88))
				else

				end

			end)
			if succes then 
			else
				print(errorMsg)
			end
		end
	end
end

task.spawn(update)

game.Players.PlayerAdded:Connect(function(plr)
	print(plr.Name)
	task.wait(2)
	for i, player in pairs(Players:GetChildren()) do
		createEvent:FireAllClients(player.Name, player.UserId)
		print("fired event for ".. player.Name)
		--local plrGui = player.PlayerGui
		--local image = plrGui:WaitForChild("ImageTemplate"):Clone()
		---image.Name = plr.Name.."Image"
		--image.Image = "rbxasset://"..4931209701
		--image.Parent = player.PlayerGui.ProgressGUI.Frame
		--local content = Players:GetUserThumbnailAsync(plr.UserId, thumbType, thumbSize)
		--image.Name = plr.Name.."Image"
		--image.Image = content
		--image.BackgroundTransparency = 1
		--image.Parent = player.PlayerGui.ProgressGUI.Frame

	end
end)


Players.PlayerRemoving:Connect(function(plr)
	print("plr removing")
	removeEvent:FireAllClients(plr.Name)
end)

Client:

local event = game.ReplicatedStorage:WaitForChild("UpdateImage")
local createEvent = game.ReplicatedStorage:WaitForChild('CreateImage')
local removeEvent = game.ReplicatedStorage:WaitForChild("RemoveImage")

local Frame = script.Parent


event.OnClientEvent:Connect(function(player, distance, NewPos)
	Frame:WaitForChild(player.."Image").Position = NewPos
end)

createEvent.OnClientEvent:Connect(function(player, id)
	print("event recieved with player ".. player)
	print(id)
	if Frame:FindFirstChild(player.."Image") then return end
	print("image does not already exist")
	local newImage = Frame.Parent.Parent.ImageTemplate:Clone()
	newImage.Parent = Frame
	newImage.Name = player.."Image"
	local content = game.Players:GetUserThumbnailAsync(id,  Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
	newImage.Image = content
	
	newImage.BackgroundTransparency = 1
end)

removeEvent.OnClientEvent:Connect(function(plr)
	Frame:FindFirstChild(plr.."Image"):Destroy()
end)

i am near certain that the issue is in this line

local content = game.Players:GetUserThumbnailAsync(id,  Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)

as when i remove the line that makes the background transparent the image is there but it does not have the players face on it as it should, this worked like literally a few minutes prior and now it just stopped, i did not touch the scripts. Any help is appreciated

So what is the issue? Any outputs or errors? If it was working a few minutes ago and just stopped and you are 100% sure you have not touched it, it’s most likely just loading issues.

Also, I’m assuming you (or whoever scripted this) realized to do gui updates on the client (since old variables still exists in the while loop, you can remove the pcall since it’s not doing any web calls anymore. It’s a waste of resources. You would also then have to check if both the Character and HumanoidRootPart (via FindFirstChild) exists since WaitForChild is also a waste of resources and will yield forever if it doesn’t find anything. You would then pcall GetUserThumbnailAsync on the client side since it is making a web call that can fail.

yes i am certain i haven’t touched the script in weeks and now it just stopped working.

There are no errors in the output, I will take into consideration some of what you suggested but the script’s been in the game as is for a long time and I never had any issues with it until now

Robloxs servers are said to have some issues on the roblox status site so i’m assuming that is the issue.

one more thing, i did a test script, i ran that same line but put it 2 different ids, the first time i did it it was my id, which didn’t work and then i ran it again with the id of a random guy i had friended on roblox, which worked.

it was an issue with my avatar, on the roblox site. For some reason wasn’t displaying so i updated my avatar and tested the script again, it worked.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.