I want to make it so when you click a Brick with a SurfaceGui in the Workspace, it prompts a purchase. But I want it so when the player purchases the developer product, it pops up with a Hint saying "(Player) has bought (Name of item)!" and it gives them the ammount of points it's set for. In short terms: When a player clicks a surfaceGUI with a textbutton and when they purchase it, it will give them player points. Here is the script I have, please help me out by making it add Player Points when they buy it, comments in the script will be helpful.
-- setup local variables
local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton
local productId = 19700135
-- when player clicks on buy brick promt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

2 comments
I wouldn't suggest making a game based off of this.
Nothing won't happen I believe.