I'm kinda new to scripting, and I wanted to know if this is correct. I haven't seen any errors in the output yet, but I'm not entirely sure it will work.
local buyButton = game.Workspace.Buttons.BuyButton.SurfaceGui.TextButton
buyButton.MouseButton1Click:connect(function(clicker)
local player = clicker:GetCharacterFromPlayer()
local leaderstats = player:FindFirstChild("leaderstats")
local user = player.userId
local productId = 19251902
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
local PointsService = Game:GetService("PointsService")
local pointsToAward = PointsService:GetAwardablePoints()
leaderstats.Diamonds.Value = leaderstats.Diamonds.Value + 10
if ( pointsToAward > 0) then
PointsService:AwardPoints(player.userId, 1)
end
end)

5 comments
Alright. Thanks. I now have a small problem, It will only work once, should I add in a while true do loop? Also, Do I need a debounce if I insert one?
No, you shouldn't need a while loop. Does it break? If so, is there output?
I tried it before in a LocalScript through a free model, It only worked once, Then I added the loop, it froze for some time, but I got to click it multiple times. I want to avoid it to freeze. I added a wait(), still froze. No output
You don't need a while loop. Click it until it doesn't work and then check the output.
ok. I'll PM you if it still doesn't work