Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What did I do wrong in my MarketplaceService script?

Asked by 9 years ago

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?

3 answers

Log in to vote
0
Answered by 9 years ago

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)
0
Still isn't working for some reason, and isn't giving an error in the Output anymore, is the service Unavailable? :c TheeDeathCaster 2368 — 9y
Ad
Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago
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.

0
Eerm, how come it works in my game?? fahmisack123 385 — 9y
0
Depends, are you using the surface gui with the script, because I think ROBLOX modified the Surface Gui events so it can track if you clicked it or not. M39a9am3R 3210 — 9y
Log in to vote
0
Answered by 9 years ago

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...

Answer this question