Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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

Ad
Log in to vote
0
Answered by 3 years ago

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)

Answer this question