I don't know what I did wrong, it won't work, here is the script;
script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, 161160031) 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:
ID = 000--Relpace with ID script.Parent.MouseButton1Click:connect(function(player) game:GetService("MarketplaceService"):PromptPurchase(player,ID)end)
script.Parent.MouseButton1Click:connect(function() 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 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...