So if i say:
~~~~~~~~~~~~~~~~~
TextButton.Mousebutton1click:connect(function(wdh) print("Hello Wald ") ------- this part right here what does this do? Does it add or what? end)
~~~~~~~~~~~~~~~~~
Mouse button click is an event attached to GUI buttons. When the button is pressed, the event is fired and the provided event is executed. In the example you've provided, you start a new function where the function is provided and write the code inside there. I don't believe there are any parameters provided to the function from MouseButton1Click so the "wdh" should not be there. So when the function is executed, it will simply print "Hello Wald " into the output. I hope this helps you understand how MouseButton1Click works. For more info - https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click
Adding onto sheepposu's answer, the actual function is written as the following:
TextButton.MouseButton1Click:Connect(function() print("hi") end)