#Fixing Positioning

2 messages · Page 1 of 1 (latest)

muted trench
#
local Main = script.Parent
local PlayerList = Main:WaitForChild("PlayerList")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Info = PlayerList:WaitForChild("INFO")

local function createUIListLayout(parent)
    local layout = parent:FindFirstChild("UIListLayout")
    if not layout then
        layout = Instance.new("UIListLayout")
        layout.SortOrder = Enum.SortOrder.LayoutOrder
        layout.Padding = UDim.new(0, 5)
        layout.Parent = parent
    end
    return layout
end

local function updatePlayerInfo(player, template, parent, index)
    local newInfo = template:Clone()
    newInfo.Name = player.Name .. "Info"
    
    local newPlayer = newInfo:WaitForChild("ImageLabel")
    local newUser = newInfo:WaitForChild("User")
    
    newUser.Name = player.Name
    newUser.Text = player.Name
    newPlayer.Name = player.Name .. "HeadShot"
    newPlayer.Image = Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
    
    newInfo.LayoutOrder = index
    newInfo.Parent = parent
end

createUIListLayout(PlayerList)

local playerInfoMap = {}

for i, v in pairs(Players:GetPlayers()) do
    if v.Name ~= Player.Name and not playerInfoMap[v.Name] then
        updatePlayerInfo(v, Info, PlayerList, i)
        playerInfoMap[v.Name] = true
    end
end
#

here