Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Pop-Up Says Gamepass Is Not For Sale Even Though It Is?

Hello. I recently have had a problem with gamepasses. I made this script, however when I step on the brick the pop-up says something along the lines of "This item is not for sale. Your account has not been charged", Even though it is for sale when I checked it. I'm honestly clueless.

local id = 5962307 --replace nil with your id

script.Parent.Touched:Connect(function(hit) local h = hit.Parent:WaitForChild("Humanoid") local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if h ~= nil then game:GetService("MarketplaceService"):PromptPurchase(player,id) end end)

That's my script. Any help is appreciated!

1 answer

✓ Accepted answer

Use the PromptGamePassPurchase function instead:

local id = 5962307 --replace nil with your id

script.Parent.Touched:Connect(function(hit)
	local h = hit.Parent:WaitForChild("Humanoid")
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if h and player then -- you don't have to put '~= nil'
		game:GetService("MarketplaceService"):PromptGamePassPurchase(player,id)
	end 
end)

1 comment

0

That worked, can't believe I missed that considering it was on the wiki. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.