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

My shop gui doesnt work and i dont know the cause. How do i fix it?

Asked by 4 years ago

It always worked untill recently...

local id = (DevProductIdHere)


script.Parent.MouseButton1Click:connect(function()
 game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id)
end)

pls help. Its in game.StarterGui.ShopButton.Frame and then theres shops. idk how to make it work and it worked when i used it in other game (as a single gui tho,) but i wanted to make it in a shop.

1 answer

Log in to vote
0
Answered by 4 years ago

I'm not very experienced with MarketplaceService, but something I know is that you're missing GetService()

Read about GetService here

If you're not interested in reading about GetService(), then here is a solution. However, I cannot guarantee that it will work.

local id = (DevProductIdHere)


script.Parent.MouseButton1Click:connect(function()
 game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent, id)
end)

If it doesn't work, it might be that the script.Parent.Parent.Parent.id is wrong. You also did a typo here: you wrote a comma "," instead of a period "." in script.Parent.Parent.Parent.id

You also don't use local id. Should you remplace it instead of script.Parent.Parent.Parent.id? I don't know, since I don't know what the "id" used here is.

Next time, also share your error. To find your error: View tab -> Console

Good developing, and hope this answer helped you :) For questions, feel free to comment.

0
01:31:55.501 - MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type ScreenGui is what it said. nikodemos333V2 7 — 4y
0
Hello. Did I be of any help? Also, thank you for sharing your error. I have never seen this before (also because I don't work with MarketplaceService), so I can't help you if I didn't be of any help. Deeply sorry if that's the case lolol1901 28 — 4y
Ad

Answer this question