Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What's wrong with my developer products!? URGENT- GAME CURENTLY HAS 600+ PLAYERS

So I've gotten several messages that in my game that sometimes the developer products aren't working. Is there something wrong with my script?!?

wait()
local MarketplaceService = game:GetService("MarketplaceService")
local character1, character2, character3, slotid, subs1250, subs100, views25000, views5000 = 42907443, 46692064, 46536644, 45098689, 45145715, 45145621, 45160253, 45160240
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
print("online")
MarketplaceService.ProcessReceipt =  function(receiptInfo) 
	print("somthing has spawned")
    local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.ProductId
    if PurchaseHistory:GetAsync(playerProductKey) then
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
    for i, player in ipairs(game.Players:GetPlayers()) do
        if player.userId == receiptInfo.PlayerId then
			print(receiptInfo.ProductId)
			if receiptInfo.ProductId == character1 then
				print("1 wurks")
                player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin1.Value].Value = 1			
			elseif receiptInfo.ProductId == character2 then
             	print("hey u should haz it")
				player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin2.Value].Value = 1
			elseif receiptInfo.ProductId == character3 then
                print("3 werks")
				player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin3.Value].Value = 1
			elseif receiptInfo.ProductId == slotid then      
                player.data.slots.Value = player.data.slots.Value + 1
			elseif receiptInfo.ProductId == subs1250 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 1250
			elseif receiptInfo.ProductId == subs100 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 100
			elseif receiptInfo.ProductId == views25000 then
				player.leaderstats.Views.Value = player.leaderstats.Views.Value + 25000
			elseif receiptInfo.ProductId == views5000 then
				player.leaderstats.Views.Value = player.leaderstats.Views.Value + 5000
			else
				print("idk fam")
				 
			end
        end 
    end
    PurchaseHistory:SetAsync(playerProductKey, true)    
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

2 comments

0

What messages are you getting? What specifically about the script is not working?

0

People are just saying they aren't reviving their points

1 answer

Change it to PurchaseId for 'playerProductKey'. Otherwise everyone can buy something only once. As the things you use to validate it will always remain the same, it's not a unique identification.

2 comments

1

Why does he need to do that? Why does he need to change it to "PurchaseId?" Why are the product(s) only able to be purchased once? Why not multiple times? Your answer is very, very vague.

0

Is that better?

This discussion is preserved as it was. New answers, comments, and votes are closed.