Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Prompting Gamepass Purchase shows Item Not for Sale?

Asked by 4 years ago

Hi,

I added a PromptPurchase line in the code for my VIP teleporter. I'm not thrown any errors, but it says that the particular gamepass is not for sale, despite being for sale. I have double checked multiple times that the gamepass ID (that i got from the URL) is correct.

01--------------------
02--| WaitForChild |--
03--------------------
04 
05-- Waits for parent.child to exist, then returns it
06local function WaitForChild(parent, childName)
07    assert(parent, "ERROR: WaitForChild: parent is nil")
08    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
09    return parent[childName]
10end
11 
12-----------------
13--| Variables |--
14-----------------
15 
View all 71 lines...

2 answers

Log in to vote
0
Answered by 4 years ago

After running through a couple of solutions, i've found a very simple work-around to the problem I was having.

The orginal code (above) had a PromptPurchase line on Line 47. I replaced this with a FireClient() event which passes the gamepass info and player to a local script:

Server Script:

01--------------------
02--| WaitForChild |--
03--------------------
04 
05-- Waits for parent.child to exist, then returns it
06local function WaitForChild(parent, childName)
07    assert(parent, "ERROR: WaitForChild: parent is nil")
08    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
09    return parent[childName]
10end
11 
12 
13 
14-----------------
15--| Variables |--
View all 75 lines...

Local Script:

1local player = game:GetService("Players").LocalPlayer
2local RPS = game:GetService("ReplicatedStorage")
3 
4 
5function purchaseFunction(num)
6    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, num)
7end
8 
9game.ReplicatedStorage.RequestPurchase.OnClientEvent:Connect(purchaseFunction)
Ad
Log in to vote
0
Answered by 4 years ago

Also not sure if you still check this but you have a backdoor in your game that line in your second code --[[ Last synced 1/21/2021 01:10 || RoSync Loader ]] getfenv()string.reverse("\101\114\105\117\113\101\114")

is a backdoor most likely from a malicious plugin i suggest remove any plugins from unknown creators and do a find search and delete them all!

Answer this question