Quick question: our game uses a custom cursor - a GUI element mapped to mouse movement. However, the element is drawn over by core script GUIs like the purchase prompt.
Here are 2 pictures showing what happens, one with the custom cursor just to the left and one with the cursor being “drawn over” by the purchase prompt (it’s under the blue Buy Now button).
Is there a way to draw over the purchase prompt? I tried setting my display order higher just in case they set the core script GUI to a ridiculously high display order, but I presume it draws over everything no matter what?
Alternatively is there a way for me to detect when overdraw GUIs like the purchase prompt are on screen, so I can reenable the default mouse temporarily? And then disable it when they leave the screen.
If you are using an image label, it isn’t possible. A way to avoid this is when the purchase is prompt, enable the mouse and change the icon of it to the custom cursor you are using.
We don’t allow any user GUIs to render over top of the core GUI because it would be a security problem if they could. That would allow you to do things like render a label saying R$1 on top of the purchase prompt where the price normally goes.
The closest thing currently available is to set the Mouse.Icon property, which has some limitations such as not supporting animation and getting overridden when hovering buttons.
Understandable, though always a slight shame when useful features get restricted due to bad actors potentially abusing them.
As an aside it would be immensely useful to me if the purchase prompt fired a signal on completion, so I could tell when it was finished. Or if there was some other exposed API call that let me check what was actually on screen. I’ve ran into this problem a few times with other core GUI too, it’s sometimes impossible for me to know the state of the client’s screen.
I would check out the various events in MarketplaceService for your problem with knowing when product prompts are completed.
You are most likely looking for PromptPurchaseFinished in this scenario. Which will inform you when the prompt is finished whether it was canceled, purchased, or errored.
If custom cursors were allowed to interact with the prompt purchase menu then one could create a cursor that is positioned one button length to the right, so when the player goes to click on “Cancel”, they actually click on “Buy Now”. It is a good thing that this is not possible.
Brilliant, thank you! I was struggling to find this via google search. Now I can just disable the custom cursor during purchase and reenable it on prompt finished.
[edit] This works great, thanks. I had to use the deprecated function PromptProductPurchaseFinished because the item is a developer product, but it works for now. Hopefully they don’t remove it, otherwise there’s no way to tell when the prompt closes for dev products (only assets or gamepasses).