how to set button value

hello everyone,I meet a problem.
there is my code
for i=1,#player.GetAll() do
local button = vgui.Create( “Button”,Menu )
button:SetPos(0,100i)
button:SetSize( 150, 30 )
button:SetVisible( true )
button:SetText(player.GetAll()
:Nick())

function button:OnMousePressed()
		

end
	
end

I Create serveral buttons Dynamicly, when i press a button i want to know which one i pressed,i don’t know how to do this.sorry about my language ,i hope you can understand ,thank you.

Use DoClick

From phone
[lua]
button.DoClick = function( self )
print(player.GetAll()*:Nick())
end
[/lua]