How to get every players picture profile in Roblox [SOLVED]

I’m trying to find a way to display every players profile picture on my bracket system and I don’t know how you can loop through every players UserId I don’t know how to display profile pic of every players something’s wrong in my code ?

function BracketManager:AssignRoundPlayers(bracketPart: Part, roundNumber: IntValue)
	local tournamentMatches = bracketPart.SurfaceGui.Tournament
	local numPlayers = self:CountPlayers()
	print("NUMBER OF PLAYERS IS : " .. numPlayers)

	for i, fighter in pairs(tournamentMatches:GetChildren()) do
		if fighter:IsA("ImageLabel") and fighter.Name ~= "WinnerPfp" then
			if roundNumber == fighter.RoundNumber.Value then
				local userId = Players[i].UserId
				local thumbType = Enum.ThumbnailType.HeadShot
				local thumbSize = Enum.ThumbnailSize.Size180x180
				local playerImage = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
				
				fighter.Image = playerImage
			end
		end
	end
end

1 Like

Warning you⚠️: Please prove your script with full version.we cannot help you without the full version of your script.

Are you inserting player’s character to a folder in workspace who entered?if you did that,you should firstly get their player object to get the profile picture of them.
You just could make a table for those who entered the tournament.

function BracketManager:AssignRoundPlayers(bracketPart: Part, roundNumber: IntValue)
	local tournamentMatches = bracketPart.SurfaceGui.Tournament
	local numPlayers = self:CountPlayers()
	print("NUMBER OF PLAYERS IS : " .. numPlayers)

	for i, fighter in pairs(tournamentMatches:GetChildren()) do
		if fighter:IsA("ImageLabel") and fighter.Name ~= "WinnerPfp" then
			if roundNumber == fighter.RoundNumber.Value then
                                local player = game:GetService("Players"):GetPlayerFromCharacter(i)
				local userId = player.UserId
				local thumbType = Enum.ThumbnailType.HeadShot
				local thumbSize = Enum.ThumbnailSize.Size180x180
				local playerImage = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
				
				fighter.Image = playerImage
			end
		end
	end
end

If theres a mistake in script it’s not my fault.be awared.

1 Like

Yo I know the issue I loop through the frame of the screengui with the number of item in the screengui but problem is now I made a loop that loop through the number of players and it doesn’t work either what do you want to see

Also what is this issue never saw that before

1 Like

Did you provided a full version of your script?if you didn’t please provide it so i can help you easily.

Oh yeah sure absolutely

BracketManager (ModuleScript)

local BracketManager = {}

local Players = {}


function BracketManager:AssignPlayerPosition()
	wait(3)

	for _, player in pairs(game:GetService("Players"):GetPlayers()) do
		table.insert(Players, player)
		
		print("PLAYER POWER IS : " .. player:WaitForChild("leaderstats").Power.Value)
		print(Players)
		print("PLAYER IS : " .. Players[1].DisplayName)
	end
end

function BracketManager:AssignRoundPlayers(bracketPart: Part, roundNumber: IntValue)
	local tournamentMatches = bracketPart.SurfaceGui.Tournament
	local numPlayers = self:CountPlayers()


	for i, fighter in pairs(tournamentMatches:GetChildren()) do
		if fighter:IsA("ImageLabel") and fighter.Name ~= "WinnerPfp" then
			if roundNumber == fighter.RoundNumber.Value then
				for j = 1, numPlayers do
					print("J VALUE IS : " .. j)
					
					
					local userId = Players[j].UserId
					local thumbType = Enum.ThumbnailType.HeadShot
					local thumbSize = Enum.ThumbnailSize.Size180x180
					local playerImage = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

					fighter.Image = playerImage
				end
			end
		end
	end
end

function BracketManager:CountPlayers()
	local AmountOfPlayers = #game:GetService("Players"):GetPlayers()
	return AmountOfPlayers
end

return BracketManager

Bracket Script

local Players = game:GetService("Players")
local AmountOfPlayers = #game:GetService("Players"):GetPlayers()
local chosen = nil
local teleportService = game:GetService("TeleportService")
local BracketManager = require(game:GetService("ReplicatedStorage").BracketManager)
wait(120)
local NumberPlayers = BracketManager:CountPlayers()
BracketManager:AssignPlayerPosition()


print("NUMBER OF PLAYERS IS : " .. NumberPlayers)

if NumberPlayers < 3 then
	print("NOT ENOUGH PLAYER TO MAKE A TOURNAMENT")
	for _, player in game.Players:GetPlayers() do
		local success, result = pcall(teleportService.TeleportAsync, teleportService, 15541201381, {player})
	end
else
	if game.ServerStorage.Brackets:FindFirstChild(NumberPlayers .."player") then
		print(NumberPlayers .."player")
		if chosen ~= nil then
			chosen:Remove()
		end
		
		local BracketChosen = game.ServerStorage.Brackets:FindFirstChild(NumberPlayers .."player")
		
		BracketManager:AssignRoundPlayers(BracketChosen, 1)
		
		--chosen = game.ServerStorage.Brackets:FindFirstChild(NumberPlayers .."player").SurfaceGui:Clone()
		chosen = BracketChosen.SurfaceGui:Clone()
		chosen.Parent = game.Workspace.DefaultBracket
		chosen.Name = "chosen"
	end
end


A DataStore error.i think the size of data exceeds the maximum MB of it.

Ok and how can I solve the issue is that something on my datasaving because of this problem it kicks players out of the game. Does that mean I have to change Database Name ??

Are you inserting the entered players characters into tournamentMatches object?

Send me your datastorecode and i can help you

Oh man you don’t want to see this aaahahhaha do you wanna have access to projects then it would be simpler at this rate

lol sure hehehehehehehehe it would be cool

agking_21 in roblox you have to add me as a friend first

i sended the request im waiting u to add me and into studio

Alright cool sad news is I’m the only scripter of this game

nothing could happen dont worry just dont care about it and forget it

Alright my PC crashed so I’m back on studio

my amd gpu also does the screen broken effect too many lines appears on my monitor.after the boot screen ends up i instantly get blue screen lol

Oh man I have to change my laptop soon but I’m broke so guess I have no choice but to go with the means I have now lol

lets talk in studio chat or this forum will be a chat XD

1 Like