I have a button with this script, and it says this item isn't for sale when I try to buy it.
local CLICK_BLOCK = script.Parent local ITEM_ID = 5347758 local Click = Instance.new("ClickDetector",CLICK_BLOCK) Click.MouseClick:connect(function(p) game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID) end)
Over the summer, roblox changed how gamepasses work. They made them their own seperate entity, rather then an asset. This means that they had to create new methods, and tinker old ones. This is included here.
PromptPurchase
takes an Asset Id (Hat, gear, etc). Instead, we must use a new method calledPromptGamePassPurchase
connect
is deprecated. Instead, use Connect
The 2nd parameter of Instance.new(X, Y)
(the Y), is deprecated. Instead use .Parent
.
local CLICK_BLOCK = script.Parent local ITEM_ID = 5347758 local Click = Instance.new("ClickDetector") Click.Parent = CLICK_BLOCK Click.MouseClick:Connect(function(p) game:GetService("MarketplaceService"):PromptGamePassPurchase(p,ITEM_ID) end)