When I click a part I want the Roblox purchase screen to come up so they can buy the developer product
I have a script but I can’t figure out how to make it run when the part is clicked


I tried putting the script in the Surface GUI and in the part.
I dont think :connect works, but I have not tried it
Put the SurfaceGui as a child of StarterGui and set the Adornee property to the part to display it on and change your script to this
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local id = "1147315827"
local player = Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, id)
end)
It does work but is deprecated and is recommended to use Connect instead
1 Like
thanks helped a lot and also I have no idea what
it does work but is deprecated and is recommended to use Connect instead
means because I dont know any scripting
Deprecated is just a term that means it still is supported but is not recommended to use anymore
connect was the old way to create an event connection, the recommended way is Connect, probably due to cleanliness, both still work but one is more preferred over the other
You could evne use players or getPlayers instead of GetPlayers and they will all still do the same thing, but the latter is the one that is recommended to use
1 Like