I want to make it so that when a player leaves the game my custom player list will update and make a new list updating all the button positions to the top most available button slot. This is my script:
local Frame=script.Parent local Button=Frame.Button local Players=game:GetService("Players") local function Add(Player) local ButtonNumber=Frame.Buttons:GetChildren() local ButtonC=Button:Clone() ButtonC.Name=Player.Name ButtonC.Text=Player.Name ButtonC.Parent=Frame.Buttons local Y=0.05*(#ButtonNumber) ButtonC.Position=UDim2.new(0,10,Y,0) end local function Update() for I,V in pairs(Players:GetPlayers())do Add(V) end Players.PlayerAdded:Connect(function(Player) Add(Player) end) Players.PlayerRemoving:Connect(function(Player) Frame.Buttons[Player.Name]:Destroy() end)
There is a folder called buttons and a default button that gets cloned into the folder inside the frame.