So, I'm making a game, and I need to know how to get the Gui that the mouse clicked. Like, say I wanted to get the name of the object that I clicked. How would I get to the Gui that I clicked? Please help.
script.Parent.MouseButton1Down:connect(function(click)
This includes the connect as well.
See where it says "script.Parent"? Direct that to the button you want to script.
Example: You have 3 buttons. One, two and three. The script has the exact same parent as the buttons, but you only want it to activate when you click button one. You do: script.Parent.one.MouseButton1Down:connect(function(click)
Hope this helps.
You don't get the button through the mouse, you get the mouse through the button. TextButton
Example:
-- StarterGui -- ScreenGui -- Frame -- TextButton -- Script local btn = script.Parent btn.MouseButton1Click:connect(function() print(btn:GetFullName() .. " was clicked.") end)