I’m making an admin control GUI for my game, and I have a scrolling frame that TextButtons go in so I can “select” a user.
I can create the buttons, but I can’t position them correctly. Currently, they just stack up but don’t spread out. Could someone try explaining how to fix this?
I’ve tried doing this
local function AddPlayerToSelect(plr: Player)
local button = Instance.new("TextButton")
button.Text = plr.Name .. "\n(@".. plr.DisplayName..")"
button.Size = UDim2.new(0, 87,0, 31)
button.TextScaled = true
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.Parent = PlayerSelect
button.BackgroundTransparency = 1
local Y
for i, child in PlayerSelect:GetChildren() do
Y = UDim.new(0, child.Position.Y + 10)
end
button.Position.Y = Y
end
for i, plr in Players:GetPlayers() do
AddPlayerToSelect(plr)
end
Players.PlayerAdded:Connect(function(plr)
AddPlayerToSelect(plr)
end)