I am trying to make a Donation Tab that calculates all the Tix and Robux donated to me. When i try to print the CurrencyType it gives me an error:
MarketplaceService.ProcessReceipt = function(receiptInfo) print(receiptInfo.PlayerId .. " just bought " .. receiptInfo.ProductId.. " for ".. receiptInfo.CurrencySpent .." ".. receiptInfo.CurrencyType) end)
Error: Workspace.DonationTab.MainParts.Script:2: attempt to concatenate field "CurrencyType" (a userdata value)
I dont know how to fix this. If you know how to solve the problem plz tell me.
As you have major paranoia, i'll just fix your very tiny segment.
If you want to insert something that isn't a string
in a string
, you must use tostring
to insert it.
Most stuff will work, except for some exceptions.
MarketplaceService.ProcessReceipt = function(receiptInfo) print(tostring(receiptInfo.PlayerId) .. " just bought " .. tostring(receiptInfo.ProductId).. " for ".. tostring(receiptInfo.CurrencySpent) .." ".. recieptInfo.CurrencySpent.Name) end)
Similarly you can use tonumber
to make a string
into a number
or an integer
, but only if it is like "5"
and you want that string
to be used as a number
then.