Need help with creating pages for a certain amount of children!

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m trying to make a screengui, that shows all the friends of the localplayer, but i want it to work with uipagelayout.

  2. What is the issue? I want to know how to make it create a page for each 6 friends!

  3. What solutions have you tried so far? I tried looking for a similar topic but couldn’t find one…

please understand that i’m not looking for how to go between pages, i need to know how to make pages for a certain amount of children.

– Example of what i want to do !

get the number of children, divide by how many can fit on one page, round up (even if its 1.3)
thats the number of pages

for exmaple:
50 friends / 6 slots = 8.3333333 rounded 9 pages

use a gridlayout to fill in the spots on each page

yes but like, how can i place them in there with scripting :sob:

once you get the number of pages loop through the amount using a for loop (for i = 1, pages)

create a template frame that you will use to clone for each page
create another template frame you will use to clone for each friend

clone the page template and for each friend (up to 6) clone the friend template and place inside the page frame (make sure it got a grid layout) (remove friend from the list once used to prevent duplicates)

now what i do is store the pages inside a folder and have a main frame where i move them over when you press the arrow (page 1 will show automatically)

1 Like

wait i do understand what u mean, but like could u give an example on how i use the for i loop for this?

Make a folder where the frames go , make a script that checks if the frames are over 6

for i = 1, pages do
    local page = pageTemplate:Clone()
    page.Name = tostringi)
    page.Parent = folderToHold
    local friend = friendTemplate:Clone()
    local f = friendsList[1]
    friend.Name = f.Name
    -- do whatever you need to do to make it look correct
    table.remove(friendsList, 1)
    friend.Parent = page

little hard because im using my memory and im on mobile

Thank you so much, will try this once done with something!

U can try this too

local Folder =“Folder”, --ParentHere)
local Fold1 =“Folder”, Folder)

function UpdatePlayers()

local i = 0
local FoldName = 1
local FoldParent = Fold1

for i,v in ipairs(game.Players:GetChildren()) do
	if v:IsA("Player") then
		i += 1
		if i == 6 then
			FoldName += 1
			local Fold2 ="Folder", Folder)
			Fold2.Name = "Fold"..FoldName
			i = 0
			FoldParent = Fold2
			v.Parent = FoldParent



wait noo, this is to get players in server, im trying to get friends of the local player, but someone solved it already soo

1 Like
	local Enumeration = Enum
	local Game = game
	local Players = Game:GetService("Players")
	local LocalPlayer = Players.LocalPlayer
	local FriendsGui ="ScreenGui")
	FriendsGui.Name = "FriendsGui"
	FriendsGui.ResetOnSpawn = false
	local FriendsFrame ="Frame")
	FriendsFrame.Name = "FriendsFrame"
	FriendsFrame.BackgroundTransparency = 1
	FriendsFrame.Position =, 0, 0.5, 0)
	FriendsFrame.Size =, 600, 0, 350)
	FriendsFrame.Parent = FriendsGui
	local BackgroundImageLabel ="ImageLabel")
	BackgroundImageLabel.Name = "BackgroundImageLabel"
	BackgroundImageLabel.BackgroundTransparency = 1
	BackgroundImageLabel.Image = "rbxasset://textures/ui/PlayerList/NewAvatarBackground@3x.png"
	BackgroundImageLabel.Size =, 0, 1, 0)
	BackgroundImageLabel.Parent = FriendsFrame
	local FriendsTextLabel ="TextLabel")
	FriendsTextLabel.Name = "FriendsTextLabel"
	FriendsTextLabel.Font = Enumeration.Font.LuckiestGuy
	FriendsTextLabel.Position =, 0, 0, 40)
	FriendsTextLabel.Size =, 0, 0, 0)
	FriendsTextLabel.Text = "Friends"
	FriendsTextLabel.TextColor3 =, 1, 1)
	FriendsTextLabel.TextSize = 40
	FriendsTextLabel.Parent = FriendsFrame
	local FriendsGridFrame ="ScrollingFrame")
	FriendsGridFrame.Name = "FriendsGridFrame"
	FriendsGridFrame.AutomaticCanvasSize = "Y"
	FriendsGridFrame.CanvasSize =, 0, 0, 0)
	FriendsGridFrame.BackgroundTransparency = 1
	FriendsGridFrame.Position =, 0, 0, 60)
	FriendsGridFrame.Size =, 0, 1, -60)
	FriendsGridFrame.Parent = FriendsFrame	
	local UIGridLayout ="UIGridLayout")
	UIGridLayout.CellPadding =, 0, 0, 0)
	UIGridLayout.CellSize =, 200, 0, 125)
	UIGridLayout.HorizontalAlignment = Enumeration.HorizontalAlignment.Center
	UIGridLayout.Parent = FriendsGridFrame
	local Success, Result = pcall(Players.GetFriendsAsync, Players, 261)
	if not Success then warn(Result) return end
	while true do
		local Page = Result:GetCurrentPage()
		for _, Item in ipairs(Page) do
			local FriendFrame ="Frame")
			FriendFrame.Name = "FriendFrame"
			FriendFrame.BackgroundTransparency = 1
			FriendFrame.Parent = FriendsGridFrame
			local FriendImageLabel ="ImageLabel")
			FriendImageLabel.BackgroundTransparency = 1
			FriendImageLabel.Position =, 50, 0, 0)
			FriendImageLabel.Image = "rbxthumb://type=Avatar&w=150&h=150&id="..Item.Id
			FriendImageLabel.Size =, 100, 0, 100)
			FriendImageLabel.Parent = FriendFrame
			local FriendTextLabel ="TextLabel")
			FriendTextLabel.Name = "FriendTextLabel"
			FriendTextLabel.Font = Enumeration.Font.LuckiestGuy
			FriendTextLabel.Position =, 0, 0, 115)
			FriendTextLabel.Size =, 0, 0, 0)
			FriendTextLabel.Text = Item.Username
			FriendTextLabel.TextColor3 =, 1, 1)
			FriendTextLabel.TextSize = 20
			FriendTextLabel.Parent = FriendFrame
		if Result.IsFinished then
	local PlayerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui") or LocalPlayer:WaitForChild("PlayerGui", 10)
	if not PlayerGui then return end
	FriendsGui.Parent = PlayerGui

I quickly whipped this up, should be fairly easy to make modifications to it.

local Success, Result = pcall(Players.GetFriendsAsync, Players, 261)

Change this line to.

`local Success, Result = pcall(Players.GetFriendsAsync, Players, LocalPlayer.UserId)`

I used Shedletsky’s user ID for the purpose of testing.

Omg, thank you so much, this is so helpful!