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

Developer Products. Currency Type not working?

Asked by
opplo 0
10 years ago

I've been trying to find an answer to this all day. I'm trying to find if the Player has purchased in either Robux or Tix, using the new developer products feature.

if receiptInfo.CurrencyType == Enum.CurrencyType.Robux then

This line wont work, I have no idea why. Help appreciated im growing very tired of this one line.

EDIT Heres the full code if you see no problem with the line.

local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

MarketplaceService.ProcessReceipt = function(receiptInfo)
    hi = Instance.new("Hint")
    hi.Parent = game.Workspace
    hi.Text = receiptInfo.PlayerId .. " has donated with "..receiptInfo.CurrencyType..""
    wait(2)
    hi:destroy()    
    if receiptInfo.CurrencyType == Enum.CurrencyType.Robux then
        script.Parent.Parent.Pos1.Transparency = 1
        script.Parent.Parent.Tix.Value = script.Parent.Parent.Tix.Value + 1
    elseif receiptInfo.CurrencyType == Enum.CurrencyType.Tix then
        script.Parent.Parent.Pos2.Transparency = 1
        script.Parent.Parent.Robux.Value = script.Parent.Parent.Robux.Value + 1
    else script.Parent.Parent.Main.Transparency = 0.5
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted 

end

1 answer

Log in to vote
-1
Answered by 10 years ago

Well, the best wiki page I can find about this would be this. My knowledge on Enum's are very limited, but according to the code, it reads in numbers.

And after more research, I found that the Enum's are put into numbers. Don't know if it helps you or not, but perhaps try something like;

if receiptInfo.CurrencyType == Enum.CurrencyType.2 then

Or maybe perhaps;

if receiptInfo.CurrencyType == 2 then

This is all based on my readings of;

If, for example, the user account ROBLOX were to buy a developer product with an ID of 1234, with Robux, the TextLabel would change to be equal to "1 just bought 1234 with 2"

0
No neither of them work sorry. No one seems to have an answer to this anywhere. opplo 0 — 10y
0
Then it must be something else in the script. AmericanStripes 610 — 10y
0
I've posted the script now then. It always fires the else statement. If I output what Enum.CurrencyType actually is then it will return "1" opplo 0 — 10y
Ad

Answer this question