local button = script.Parent local ID = Your ID local click = Instance.new("ClickDetector", button)
click.MouseClick:Connect(function(player) game:GetService("MarketplaceService"):PromptPurchase(player, ID) end)
The script is working, but why is the gamepass itself isn't working? It says the item is not for sale. It is on sale and active and available under the store of my game.
I see your mistake. PromptPurchase() is only for clothing items or items that go in your inventory like hats! (Only your hats and shirts and pants). You must use PromptGamePassPurchase() Like the listed below. Also please use the code boxes for code. Thanks!
local button = script.Parent local ID = Your ID local click = Instance.new("ClickDetector", button) click.MouseClick:Connect(function(player) game:GetService("MarketplaceService"):PromptGamePassPurchase(player, ID) end)