Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I forgot how Mousebutton1click works?

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)


1 comment

0

MouseButton1Click :)

2 answers

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.