So I have been trying to make currency purchasing in my game the prompt if player clicks button is supposed to go up to buy dev product but the output says player needs to be player or something like that what wrong with the code???
MPS = game:GetService(“MarketplaceService”)
id = 1068491731 – replace with your ID
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
MPS:PromptProductPurchase(player.UserId, id)
end)
It isn’t the player ID, its the player Instance. There’s an example of this seen here. The only issue with this code is the indentation and how it’s laid out.
Yes, for that method. I think the problem is that the id is a gamepass id and should be prompted by :PromptGamePassPurchase()MarketplaceService:UserOwnsGamePassAsync
MPS = game:GetService(“MarketplaceService”)
id = 1068491731 – replace with your ID
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
MPS:PromptGamePassPurchase(player.UserId, id)
end)
This code looks outdated, but it still works.
Edit: Just noticed that I was checking for the gamepass, not prompting the player it.