Hello everyone, I was just wondering how to detect when a player has bought a certain gamepass.
I made a gui that displays a lock on a certain weapon when the player doesn’t own the gamepass, but I want to hide the lock UI when the player buys the gamepass.
I thought of using MarketPlaceService.PromptPurchaseFinished, but that doesn’t work if they buy it from the Store tab on the game page.
I’m not too sure what you mean but I think I have an understanding but why don’t you try to check every couple of seconds if the player owns the gamepass?
local MarketPlaceService = game:GetService("MarketPlaceService")
local BoughtGamepass = MarketPlaceService.UserOwnsGamePassAsync(game:GetService("Players").LocalPlayer.UserId, GAMEPASS_ID)
while wait(3) do
if BoughtGamepass then
-- what to do here
end
end
I think the variable must go inside the loop, else it wont update because it will only kept storaged if the player had the gamepass before the loop started
You could possible recreate the old behavior by creating a function that sends a proxy request to the roblox api page to see if the player still owns the gamepass. This would require knowledge of HttpService though.