Basically i tried to change this script so that it would give player points instead of gold and health but it doesnt do that (This script is in workspace)

local MarketplaceService = game:GetService("PointsService")
	local HealthID, GoldID = 20215653 , 20215669
	local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
	 
	MarketplaceService.ProcessReceipt = function(receiptInfo)
	    local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
	    if PurchaseHistory:GetAsync(playerProductKey) then
	        return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it.
	    end
	    -- find the player based on the PlayerId in receiptInfo
	    for i, player in ipairs(game.Players:GetPlayers()) do
	        if player.userId == receiptInfo.PlayerId then
	            -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)
	            if receiptInfo.ProductId == HealthID then
	                -- handle purchase. In this case we are healing the player.
	               game:GetService("PointsService")AwardPoints(player.userId,200)
	             elseif receiptInfo.ProductId == GoldID then
	             game:GetService("PointsService")AwardPoints(player.userId,400)
	            end
	        end
	    end
	    -- record the transaction in a Data Store
	    PurchaseHistory:SetAsync(playerProductKey, true)   
	    -- tell ROBLOX that we have successfully handled the transaction (required)
	    return Enum.ProductPurchaseDecision.PurchaseGranted    
	end

This one is in the actual GUI button (Local Script)

--Local script
	    id = 20215712
	sp = script.Parent
	    p = game.Players.LocalPlayer
	 
	    sp.MouseButton1Down:connect(function()
	        game:GetService("MarketplaceService"):PromptProductPurchase(p, id)
	    end)    


1 comment

0

I believe the problem is where i attempt to change it to PointsService in the first script