Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ItsMeKlc 235 Moderation Voter
7 years ago

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
0
What messages are you getting? What specifically about the script is not working? Monsieur_Robert 338 — 7y
0
People are just saying they aren't reviving their points ItsMeKlc 235 — 7y

1 answer

Log in to vote
-2
Answered by 7 years ago
Edited 7 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your 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.

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. TheeDeathCaster 2368 — 7y
0
Is that better? metropolish30 6 — 7y
Ad

Answer this question