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
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.
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
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
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 ??