Circle layout UI

I am trying to make something similar to this:

I want there to be a little section for each player in the server in a circle shape, what I have so far is this:
image

How could I make this change into a circle instead of the grid layout would I need a different UI element??

1 Like

Could you elaborate on what you mean? Maybe a drawing of what you would like it to look like?

Just a little frame for each player that would join the layout when another player joins the server or leaves. So like if a player joins the server the circle of players would grow by making room for the new player, and everyone would be spaced out evenly.

Something like this:


And then if another player joins it would split the circle into three.

Another example of each player getting their own section would be something like this game: Word Bomb - Roblox

This code makes the player frames go into a circular type of layout. Note that it is a loop, but you can dissect it and try to use it. :slightly_smiling_face:

function getPlayerCount()
	return #(game.Players:GetChildren())
end

function updateList()
	local GetPlayers = game.Players:GetPlayers()
	local a = getPlayerCount()
	local b = 360
	local c = 0
	local n = b / a
	
	if script.Parent:FindFirstChild("PlayerFrame") then
		for _, value in pairs(GetPlayers) do
			if script.Parent:FindFirstChild("PlayerFrame") then
				script.Parent:FindFirstChild("PlayerFrame"):Destroy()
			end
		end
	end

	for _, value in pairs(GetPlayers) do
		c = c + n
		
		local uiClone = game.ReplicatedStorage.ProfileGui.PlayerFrame:Clone()
		uiClone.Parent = script.Parent
		local	x = 100 * math.sin(math.rad(c)) -- The 100 is the distance from the center mark
		local y = 100 * math.cos(math.rad(c)) -- The 100 is the distance from the center mark
		
		uiClone.Position = UDim2.new(x, 0, y, 0)

	end
end

while true do
	c = 0
	updateList()
	wait(5)
end

EDIT: here is the explorer page
Screenshot (104)

1 Like

This isn’t working the frame for each player isn’t showing up for me. What does it look like for you?

Each dot is a frame

image

EDIT: try changing the distance to a lower number it is probably just off the screen the distance scales off the size of the parent frame

Could I add you into a team create? I can’t figure out the right position.

Your use of FindFirstChild… it scares me. Why are you checking if PlayerFrame exists, 3 times? And the 3rd use of it is useless. I’m assuming the code is wrong and you meant to check each player’s UI instead.

I copied that part of code from a player list Ui that I had saved in file, and didn’t care to mess with it because it worked, very old code from when I started.
Edit: But I do see what you mean, thanks.

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