In game part purchase button

the clickdetector part in the script is underlined with orange meaning its an error

i changed it to this but it still doesnt work
local MSS = game:GetService(ā€œMarketplaceServiceā€)

script.Parent.ClickDetector.MouseClick:Connect(function(player)
MSS:PromptProductPurchase(player,1089722893)
end)

H i just got this problem before and noone helped me but i got the solution the solution is insert local script in starter gui and script in it if you know how to use marketplace service then it will work GL

the thing is i dont want it in a gui, i want it in a physical part

I know i am not saying gui i am saying instert local script in starter guiā€™s screen gui not in screenā€™guis image or use this script like

This is the local script that need to be in starterguiā€™s screengui(screengui can be empty)
game.Workspace.yourobject.Touched:Connect(Function)
game:Getservice("marketplaceservice):PromptGamePassPurchase(game.players.localplayers,your id)
end)

also i want it to be a click part not touch

Then just use yourobject.Clickdetector.MouseClick:Connect(Function()

Just change the thouched connect function to your part.Clickdetector.MouseClick:ConnectFunction()

@kiri1234jojo Or you can use my model

Need only change event name and add clickdetector

game.Workspace.buy.Clickdetector.MouseClick:ConnectFunction()

game:Getservice("marketplaceservice):PromptGamePassPurchase(game.players.localplayers,ID)

end)

ur script has a big red lineā€¦ error

Is this what you wrote? There is spelling problem

i just copied ur script from what u wrote earlier

ok lemme get into studio for this

I am gonna tell you what to do.
1.Insert a part in the workspace, and insert a click detector inside of it.
2.Insert a script into the click detector.
3. Type the following code in the script:

local MSS = game:GetService("MarketplaceService")

script.Parent.MouseClick:Connect(function(player)
    MSS:PromptGamePassPurchase(player,idhere) -- put your id in the "idhere" section
end)
  1. It should work now.

What i said i dont think he understood Btw Thanks for replying me lol

error
image

Re-copy the code, I edited it.

error
image

local MSS = game:GetService("MarketplaceService")

script.Parent.MouseClick:Connect(function(player)
    MSS:PromptGamePassPurchase(player,idhere) -- put your id in the "idhere" section
end)

This is the final code. I bet this is going to work.

I am gonna give you the model you didnt understnad what i meant

Have a good day

1 Like