Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

unable to cast value to object from promptgamepasspurchase function?

Asked by 3 days ago

the player has already been defined earlier in the script, I just dont think people feel like reading through 50 lines of code.

getting this error: Unable to cast value to Object. the error is on the promptgamepasspurchase function. everything else works fine

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,v.Gamepass.Value) then
                                                Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
                                            else
                                                game:GetService("MarketplaceService"):PromptGamePassPurchase(player.UserId,v.Gamepass.Value)
                                            end

1 answer

Log in to vote
0
Answered by 3 days ago

You're using

player.UserId

when you should just be using

player

PromptGamePassPurchase takes the player Instance as the first argument.

Ad

Answer this question