I have a button, right by the VIP door in my game and I want you to be able to buy the gamepass, by pressing the button. Heres my script. The error is it saying "Unable to cast value to Object".
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.UserId,ITEM_ID)
end)

1 comment
You're getting this error on what line?