Need help making a randomized UI System. (No clue where to start.)

My goal is to make a randomized navigation system. You need to select a single planet from a large array of planets inside of a UI that you can move around, (generated randomly every server).

It is very important that all of this be done on a Surface Gui visible to all players, not a player gui.

What I want exactly in more detail is, (And btw I’m not sure how to really do any of this.)

I want a UI that moves freely in all directions (if possible),

Random Images will spawn inside the UI at that moves freely (The planets),

You can select a planet, and it will become centered in the UI,

The selected planet gets saved and changed when you select a new one.

The hardest part about all of this to me, is probably going to be the randomized creation of planets that everyone can see.

I don’t need people to make the scripts for me, I just honestly have no clue where to even start, or how to achieve any of this. Getting the end result is not the problem, knowing how to get the end result is the problem.

The UI system I desire is much like the Navigation system in Starbound.
If anyone played that, props to you. If you haven’t, here’s what it looks like.

Generating which planets to show should be relatively easy. If you have an array of planets, simply select a random one using math.random(1, #planetsTable).

Judging by the video, i’m guessing you also want to random place the planets as well, which is a bit more complex. You would need to define maximum and minimum X, Y positions that the planets can be placed at, making sure to keep it a bit inside the edge of the UI.

You can then do something along the lines of:

ui.Position = UDim2.new(0, math.random(minX, maxX), 0, math.random(minY, maxY))

Extra maths can be added to ensure the planets don’t “collide” with each other.

Some alternative methods may include having set locations where planets will be (lets say there is 20 locations, but only 10 planets will be generated). This gives a somewhat random effect, while making it significantly easier to program.

I’ve already done a lot of thinking and I have a general plan on what to do, the only thing I need to look into though is the easiest way to tell what the closest ui in a direction is.