I don't know what I did wrong, it won't work, here is the script;
1 | script.Parent.MouseButton 1 Click:connect( function () |
2 | game:GetService( "MarketplaceService" ):PromptPurchase(game.Players.LocalPlayer, 161160031 ) |
3 | end ) |
The Output said MarketplaceService:PromptPurchase() player should be of type Player, but is of type nil
, but I don't know what it means by that, what have I done/what did I do wrong?
You need to put it in a normal script:
1 | ID = 000 --Relpace with ID |
2 |
3 | script.Parent.MouseButton 1 Click:connect( function (player) |
4 | game:GetService( "MarketplaceService" ):PromptPurchase(player,ID) end ) |
1 | script.Parent.MouseButton 1 Click:connect( function () |
2 | game:GetService( "MarketplaceService" ):PromptPurchase(script.Parent.Parent.Parent.Parent, 161160031 ) --I am just going to assume the parent properties go like so from script Button > ScreenGui > PlayerGui > Player |
3 | end ) |
The problem fahmisak has was, MouseButton1Click
didn't return the player, in fact it doesn't return anything. Though I am just assuming you are using a classic ScreenGui rather than a SurfaceGui since you used a local script. Anyways, I think the script is fixed.
I found the post by M39a9am3R helpful for my ingame currency purchase GUI except how would I make it work with developer products? When I use it for my developer product, my developer product seems to share an ID with a "Happy Home in Robloxia" place...