You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I wanna close a gamepass purchase prompt -
What is the issue? Include screenshots / videos if possible!
I cant find a way to do it i noticed pls donate can do it -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I checked and could not find a solution
i wanna do this so i can let players sell there ingame items for robux but if 2 people have the screen open at the same time that will ofc not work. i created an update async system which makes sure that doesnt happen but if someone leaves it open they can stop all purchases i wanna make it so u have 3 seconds to click purchase before the gamepass purchase screen closes.
local price = donationserver.PromptGamepassPurchase(player,gamepassid)
if price then
remotes.ShowBanner:FireClient(player,true,"Starting Item transfer")
local data = game:GetService("DataStoreService"):GetDataStore(_G["DataStorePrefix"].."l"..assetid)
local userwebuyingfrom
local userwebuyingfromname
local function func(list)
for i,v in ipairs(list) do
if v[5] == gamepassid then
userwebuyingfrom = v[1]
userwebuyingfromname = v[2]
table.remove(list,i)
end
end
return list
end
local success, listings
local count = 0
while not success do
if count >= 1 then
warn("Retrying, count:", count, "\nError:", listings)
task.wait(7)
end
success, listings = pcall(data.UpdateAsync, data, "Listings",func)
count += 1
end
spawn(function()
core.RemoveItemFromInventory(userwebuyingfrom,assetid,serial)
end)
spawn(function()
core.AddItemToInventory(userid,assetid,serial)
end)
spawn(function()
local assetname = core.GetAssetName(assetid)
local username2 = userwebuyingfromname
local topost = game:GetService("HttpService"):JSONEncode({"Donation",username.." Bought a "..assetname.." off "..username2.." for "..price.." R$"})
game:GetService("MessagingService"):PublishAsync("d",topost)
end)
local Earned = math.floor(price * 0.7)
local Donated = price
spawn(function()
core.RemoveListing(assetid,serial)
updatebp(assetid)
end)
remotes.Bought:FireClient(player)
remotes.ShowBanner:FireClient(player,true,"Purchased #"..serial.." for "..price.." R$")
spawn(function()
core.AddRecentSale(assetid,"R$"..price,username,userwebuyingfromname)
end)
else
remotes.ShowBanner:FireClient(player,false,"Purchase Cancelled")
local function func(f) --revert the gamepass
return assetid
end
local success, Response
local count = 0
while not success do
if count >= 1 then
warn("Retrying, count:", count, "\nError:", Response)
task.wait(7)
end
success, Response = pcall(passdata.UpdateAsync, passdata, gamepassid,func)
count += 1
end
end