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 want to figure out why the GamePass Purchase event is not working when the player buys the game pass
-
What is the issue? Include screenshots / videos if possible! The GamePass PromptPurchase Finished Event won’t fire
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have looked through my code tried to find the issue found out that the remote event fires but nothing else
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Client
local MarketPlaceService = game:GetService("MarketplaceService")
local GamePassId = 46665813
local GamePassPurchaseHandler = game.ReplicatedStorage.GamePassPurchaseHandler
local function PromptGamePassPurchase()
local Player = game.Players.LocalPlayer
local OwnsGamePass
local Sucess,ErrorMessage = pcall(function()
OwnsGamePass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamePassId)
end)
local Button = game.Workspace.PromptPurchasePart.ClickDetector
if not Sucess then
warn("Unable to tell if the user owns the Gamepass")
end
Button.MouseClick:Connect(function()
if OwnsGamePass then
print(Player.Name .. " Already owns this GamePass ")
elseif not OwnsGamePass then
print(Player.Name .. " Does not own this Gamepass ")
MarketPlaceService:PromptGamePassPurchase(Player, GamePassId)
GamePassPurchaseHandler:FireServer()
print("Firing the Server")
end
end)
end
task.wait(5)
PromptGamePassPurchase()
Server Script
local MarketPlaceService = game:GetService("MarketplaceService")
local GamePassId = 46665813
local GamePassPurchaseHandler = game.ReplicatedStorage.GamePassPurchaseHandler
GamePassPurchaseHandler.OnServerEvent:Connect(function()
print("Sever Has been fired by the client")
local function GamePassPurchaseCheck()
local Player = game.Players:GetPlayerByUserId()
local OwnsGamePass
local Sucess,ErrorMessage = pcall(function()
OwnsGamePass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamePassId)
end)
-- Problem right here
MarketPlaceService.PromptPurchaseFinished:Connect(function(Player, PurchaseId, IsPurchased)
if IsPurchased and PurchaseId == GamePassId then
print(Player.Name .. " Has Bought the GamePass! ")
else
print(Player.Name .. "Has Canceedl the Game Pass Purchase")
end
task.wait(2)
GamePassPurchaseCheck()
end)
end
end)
Hello so when i was testing out a GamePass purchase i have found out that the server does not print out that the purchased finished to the output why is the event not firing?