How would I get this custom proximity prompt to work?

Quick heads up: I am not using Roblox’s built in proximity prompts, rather my own custom ones.

I’m making a custom proximity prompt using BillboardGuis, and I’m stuck on how to get the functions of it to work for others.


^^ what it looks like

I’m wondering: how would I make it so, when someone pressed E, it would do something? (for now, let’s say it’d print the word “arrested”.)

Alright. So, you can use UserInputService to record the keys, right? Now, when someone either presses Q or E, you can run a check if that ui is visible to the current player, if it is visible then you can fire a remoteevent to the server, where the server does the stuff. This is my idea, not bad not best though.

How could I check whether it’s visible? I’m using max distance, and as far as I know, there is no property, function, or event that checks whether it is. Unless I’m just dumb.