PromptGamepassCancel Support

How could i detect if the player hit the cancel button while Prompting the gamepass

The image is the example, as you can see there is an “Cancel” Button and i wanted to know or detect whenever the player hits it


This is the code as you can see in the 3rd line below printing there is an Sound that plays whenever the gamepass was purchased, and i wanted to play other sound whenever the player cancel the prompt.

Can anyone helped me in here?

The 3rd parameter of the function is wasPurchased (boolean) so you can check whether or not the person getting the option to buy it is cancelling it or purchasing it

How could i do that? I’m little bit bad at understanding when it comes in coding and stuff

mp.PromptGamePassPurchaseFinished:Connect(function(player, id1, wasPurchased)
	if wasPurchased then
		-- your code
	else
		-- your code
	end
end)
1 Like

Thank you for giving me an clear explanation and examples. I’ll look afterward!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.