Get top 3 players

I am currently trying to get the top 3 players. I have this code

local function sorted_by_highest()
    local player_list = Players:GetPlayers()
    table.sort(player_list, function(p1, p2)
        return p1.Points.Value > p2.Points.Value
    end)
    return player_list
end

if player_list[1] then
		print(player_list[1].Name)
		script.Parent.first.Text = player_list[1].Name
	end
	if player_list[2] then
		script.Parent.second.Text = player_list[2].Name
	end

it works while testing locally but when i test it with my friend it just stays in alphabetical order or something
its in a localscript in startergui

The player list is jus getting the Players so I roccmenebd using for I,v ipairs() that’s what I would do but if not a huge problem then okay

like this?

local player_list = {}

	local function sorted_by_highest()
		for i,v in ipairs(game:GetService("Players"):GetPlayers()) do
			player_list[i] = v
		end
		table.sort(player_list, function(p1, p2)
			return p1.leaderstats.Time.Value > p2.leaderstats.Time.Value -- or whatever you want to sort
		end)
		return player_list
	end

it currently doesnt work. it just shows your username first

The point of ipairs to make it ordered as I remember so you to put v in a table also as username then do what you want with them as they will print out in order

i think its because its a localscript