What is the MouseButton1Down version for TextButtons?

Hello, i am working on an object which has TextButtons on it, and it wont activate using MouseButton1Down, and i am wondering if i need to use a different function to activate it.

if you need any details about the script or object or anything related to it, just ask.

local marketplaceservice = game:GetService(“MarketplaceService”)
local button = script.Parent:WaitForChild(“Plus5TextButton”)

button.Activated:Connect(function()

marketplaceservice:PromptProductPurchase(game.Players.LocalPlayer, 684859645)

end)

thanks.

edit: also forgot to mention that it is in a surfaceGUI on a part if that helps.

1 Like

TextButtons have their events through the inherited GuiButton class, but you’re probably looking for MouseButton1Click or MouseButton1Down.

1 Like

There’s also the Activated event which pratically works exactly the same as MouseButton1Click

The script should work fine, but there could be a number of things that might cause it to not work.
Check if activated is false (activated being false makes Activated not fire), and also make sure your local script is in a place where it will run (workspace is not one of them). Considering your script references its parent to get the button, it assume the script is inside the gui, so if you put the surface gui in the part (inside workspace) the local script will not run. If this is the case, either move the script outside of the surface gui and into another place (like StarterPlayerScripts) or move the surface gui into StarterGui and set Adornee to the part.

1 Like

Thanks it works! i just had to change where it said script,parent and changed it into its game location!

1 Like