I was wondering if you can retrieve a textbutton instance when you click it
I tried this and it doesnt work, maybe there is another way?
local button = script.Parent.TextButton
local function clickButton(buttonThatGotClicked)
print(buttonThatGotClicked.Name)
end)
button.MouseButton1Click:Connect(clickButton)
I’m trying to make a shop with multiple items, and when it gets clicked I want that the name of the button gets sent to the function.
So that the script can check which item has been clicked on so it can show the player the cost, description and name of said item
To add to my original reply if you still want to use that function just make the name of the button a parameter once the connection realizes its clicked.