Simple scoreboard

Im trying to make a simple scoreboard that takes the players score either when they die of win and updates it to the scoreboard umg widget .
this is what I put together.

But im unsure how I would automatically have each score placed in the correct order on the list of high to lowest score.
I have tried to follow some tutorials on this but get lost on this one.
also scores need to be saved and overwritten by new scores that are higher.
any tips would be great.

Use an array with a structure consisting out of the data you want to show.

Implement a sorting algorithms like bubble sort in blueprint and call it when you want to sort the array.
(search for bubble sort in your favorite search engine)

Than you have ti define when to call the sort.
The easiest way would be to call the sorting method in the Tick if the UMG. Another way would ve to bind the an UMG event to the actual vales changes in yout GameMode, GameState or GameInstance.

In the UMG loop over your sorted array and show the entries.

Example for sorting: