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

This script worked before, and now it just stops working without edits done to it... Help?

This script has been working before, and then it just happened to stop working. No output is shown.

NOTE: There is an IntValue in every player that joins the game named "AutoClickers". NOTE: The AutoClickerID is a Developer Product.

local MarketplaceService = game:GetService("MarketplaceService")
local AutoClickerID = 20436449
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerStats")
 
MarketplaceService.ProcessReceipt = function(receiptInfo) 
    local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
    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
            if receiptInfo.ProductId == AutoClickerID then
				repeat wait(.001) until player:findFirstChild("AutoClickers") ~= nil
                player.AutoClickers.Value = player.AutoClickers.Value + 1
				DataStore:SetAsync("AutoClickers_" ..player.Name.. "", player.AutoClickers.Value)
            end
        end	
    end
    PurchaseHistory:SetAsync(playerProductKey, true)	
    return Enum.ProductPurchaseDecision.PurchaseGranted		
end

1 answer

I'm pretty sure that you need to enable HTTP api. I was reading through some ROBLOX core code, and that seems like the likely culprit.

Either that, or somewhere down the line, you're using animations that don't want to work. If you have any non-default ROBLOX animations, try disabling them for the time being.

JSON encoder/parser core code. Maybe you can find something I wasn't able to.

9 comments

0

I just enabled HTTP and the script still won't work when I purchase the Developer Product.

0

Hmm... that's strange, it seemed quite likely that was the issue. Did you try the second method?

0

Well all my animations are ROBLOX's default animations.

0

Even more strange, this sounds like a specific-to-place issue. Take a look at the link I edited into my post, it's the GitHub with the ROBLOX core code -- your issue is outputted at line 495/496.

0

I actually just figured out that the Output Error is directed to another script. Since that is the only thing showing up, the script I posted is displaying nothing in Developer Product / Output. I removed the link to the errors in the original post.

0

Everything looks like it should work when reading through. My only suggestion is to add a print of some sort after every check, to see exactly where it's stopping up on you.

0

Huh, here's something. I put prints on the outside of the function (before and after the function), and prints inside the function. The only prints that showed up were the prints outside of the function, and that was right when the server began. When I purchased the Product, none of the prints showed up.

0

This is probably a redundant question, but are you sure that the ID you're using is correct? An accidental backspace could have occurred without your knowledge.

0

The ID is correct.

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