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

Why isn't this script prompting the player to purchase the developer pruduct?

Why isn't this script prompting the player to purchase the developer pruduct?

I am trying to make it so that when the part is clicked (via a ClickDetector), it will prompt the player who clicked to purchase a developer product, but it does not work, why?

There are no errors, and the id of the developer product is correct.

My script is not disabled

I use a server-sided script inside a Union with a clickdetector inside the Union as well.

My coding is as follows:

local MarketplaceService = game:GetService("MarketplaceService")
local productId = 47847411

script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
	local player = playerWhoClicked.Name
	MarketplaceService:PromptProductPurchase(player, productId)
end)

Any help is greatly appreciated!

2 comments

0

This will give you an error as you are giving a string where an object is required.

0

But it didnt :P

1 answer

✓ Accepted answer

You need the Player instance, not the PlayerName, do PlayerWhoClicked and it should work fine.

1 comment

0

Heh I'm too fast XD

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