Alright so I'm trying to make a VERY basic lobby system and I'm having trouble with changing the position of the lobby frame (used to join) relative to other lobby frames. Here's my code:

game.ReplicatedStorage.openLobby.OnServerEvent:Connect(function(plr)
    
    local lobbies = {}
    
    for i,p in pairs(game.Players:GetChildren()) do --for every player
        local playerGui = p.PlayerGui
 
        local newLobby = Instance.new("Frame")
        
        newLobby.Size = UDim2.new(0, 222, 0, 55)
        
        newLobby.Name = plr.Name.."'s lobby"
        
    
        if #lobbies <= 0 then
            
            newLobby.Parent = playerGui.ScreenGui.ScrollingFrame
            
            newLobby.Position = UDim2.new(0, 0, 0, 0)
            
            table.insert(newLobby, lobbies)
            
        else 
            
            --change newLobby position depending on values in lobbies
            
            newLobby.Parent = playerGui.ScreenGui.ScrollingFrame
            
            table.insert(newLobby, lobbies)
        end
        
    end
end)

1 comment

0

Found a solution! Using a UIGridLayout seems to be the best option.