I want to make it so when a Player BUYS a Developer Product, it gives them one point. But I am stuck on the part when it gives them it when they only BUY it:
-- 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) local PointsService = Game:GetService("PointsService") local pointsToAward = PointsService:GetAwardablePoints() local universeBalance = PointsService:GetGamePointBalance(player.userId) if ( pointsToAward > 0 and universeBalance == 0) then PointsService:AwardPoints(player.userId, 1) --Btw, do I change this to my ID? end end) PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance) local message = Instance.new('Hint', game.Workspace) message.Text = "Point awarded to " .. userId .. ". This player now has " .. userBalance .. " points total!" wait(5) message:Destroy() end)
Here
-- 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) local PointsService = Game:GetService("PointsService") local pointsToAward = PointsService:GetAwardablePoints() local universeBalance = PointsService:GetGamePointBalance(player.userId) if ( pointsToAward > 23 and universeBalance == 0) then --23 or 1 or whatever PointsService:AwardPoints(player.userId, 1) --Id is fine end end) PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance) local message = Instance.new('Hint', game.Workspace) message.Text = "Point awarded to " .. userId .. ". This player now has " .. userBalance .. " points total!" wait(5) message:Destroy() end)
This should work...