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

unable to cast value to object from promptgamepasspurchase function?

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

✓ Accepted answer

You're using

player.UserId

when you should just be using

player

PromptGamePassPurchase takes the player Instance as the first argument.

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