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

Why is my purchase prompt outputting "Unable to cast value to Object"?

Asked by
ClouZek 16
5 years ago
Edited by User#24403 5 years ago

So I am trying to prompt players with a purchase for a product called "Crystals" and this is the code I put in.

local function crystalPurchase(player)
    game:GetService("MarketplaceService"):PromptProductPurchase(player, crystalOfferID.Value)       
    print("Crystal purchase prompted")
end

And when the player clicks the button its connected. I have tried making Marketplace Service a variable and using plr instead and also,

crystalOfferID.Value

is a variable for a Number Value inside my script with the products ID

I have also tried putting in the ID plain or in a variable and it will say

"Unable to cast value to Object"?

0
You need to post more code. Where are you calling `crystalPurchase` User#24403 69 — 5y
0
IS there supposed to be a Promt purchase code in it? Like the product id? DuckyRobIox 280 — 5y

Answer this question