I am creating a simple button to prompt a product purchase but the MouseButton1Click does not seem like working. I could not find any thing that I understand which could solve it. The local script’s parent is a text buttons . The parent of the text button is just a frame and the frame’s parent is a surface gui and the frame’s children are 5 other textbuttons and a text label all not overlapping
local mps = game:GetService("MarketplaceService")
local product = 1086223418
local player = game:GetService("Players")
local plr = player.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
print(script.Parent.." has been clicked")
mps:PromptProductPurchase(plr,product)
end)
Edit: Changed the parent from frame to TextButton in the post because I typed it out wrongly.
Edit changed it to text buttons. Why do I keep mixing them up?
if you really want to use a frame, you can check if your clicking and if your clicking then check where the cursor position is. If it is on the frame then you trigger the function.
Or, just use a button because its well easier
Hmm, i think i found the problem.
If what @pwnion said is true, then that is the correct answer. However if it is in StarterGui, then I think you need to fire an event to the server when clicked, then copy and paste the productid and marketplaceservice in a Script. Dont send any data. Try it if it works.