PromptProductPurchase in ProximityPrompt not working

Hi there, I’m making a game and I have a proximityprompt here (inside of the player) that is supposed to prompt a product purchase but it isn’t, can I have some advice?

I’m using a LocalScript inside of the ProximityPrompt.

script.Parent.Triggered:Connect(function()
	local plr = game.Players.LocalPlayer
	
	game.MarketplaceService:PromptProductPurchase(plr, "1219020831")
end)

1 Like

Do not wrap the ID in quotes. The value passed should be a number, not a string.

1 Like
local MPService = game:GetService("MarketplaceService")
local gamepassid = 1219020831

script.Parent.Triggered:Connect(function(player)
	MPService:PromptProductPurchase(player, "1219020831")
end)

The 2nd argument passed to “PromptProductPurchase” should be an integer value (not a string), also whenever a ProximityPrompt instance is triggered resulting in the “Triggered” event firing the player which caused the trigger is automatically passed as an argument to any function connected to the event, therefore all we need to do is declare a parameter in the function (which you can name anything) to handle the passed player instance, therefore defining the player isn’t necessary using “game.Players.LocalPlayer” isn’t needed.

1 Like

I don’t think it makes a difference, on mobile rn so I can’t test

when you can try:

local ID = 1219020831
script.Parent.Triggered:Connect(function()
	local plr = game.Players.LocalPlayer
	
	game.MarketplaceService:PromptProductPurchase(plr, ID)
end)
local player = game.Players.Localplayer
local productId = 1219020831

script.Parent.Triggered:Connect(function()
   game.MarketplaceService:PromptProductPurchase(player, productId)
end)

Try the script above and see if it works. The product Id is the ID of your Developer Product.

Remember that the Localplayer has to be defined outside the function, not inside it.

@ValiantWind @Limited_Unique @Ty_Scripts @koi1299

I’ve tried your solutions, still doesn’t seem to be working and there’s nothing in the output which is annoying

(oh shoot, I have music in that video)

I’ve just tried adding a print before the promptproductpurchase and it does not print at all, are ProximityPrompts server sided only?

After triggering ProximityPrompt, nothing happens at all:

Any solutions?


DevHub does say that it’s supposed to work in a LocalScript, so I’m confused, I might try seeing if I can put the prompt in another part

Edit: Didn’t work.

Finally fixed it, after a lot of trial and error, it needed to be a server sided script. Thank you to everyone who have tried to help!

1 Like