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

Script/LocalScript wont do anything after clicking on TextButton, No errors. ???

I tried to make SurfaceGui button that Prompts my product but it doesnt do anything, tried to print player but its not printing so i guess function wont start on click :
Script:

local mark = game:GetService("MarketplaceService")
function ad(yeah)
	print(yeah)
	mark:PromptProductPurchase(yeah, 10371541)
end

script.Parent.MouseButton1Down:Connect(ad)

Also tried to move it to Script and LocalScript, and still didnt worked.

Explorer Screenshot: here

2 answers

✓ Accepted answer

Well I think I might be able to help,

If the function operates of the click of a gui For Gui's you need to add a function called

MouseButton1Click:Connect(function()
--Script here
end)

However if you want to detect a click on a part you would need A click detector and a script with Code saying:

script.Parent.MouseButton1Down:Connect(function() --Doesn't have to be script.parent
	
end)

script.Parent.MouseButton1Down:Connect()

If this helped please accept it. -Snips

This is how I do my UI Prompt

local MarketServer = game:GetService('MarketplaceService') -- Assigning Variable 

local plrs = game:GetService("Players") -- plrs
 
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function() -- To make button active
	print('Product Prompt Purchase') -- Personal Choice
	local plr = plrs.LocalPlayer -- Local Player
	MarketServer:PromptProductPurchase(plr, p.id)  -- only change the p.id (product id)
end)

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