Hello,
In games like Jailbreak and Northern Frontier they have this ‘E’ button system to interact with cars, trees and just about anything. I was wondering how that may be done? Perhaps something like a Billboard GUI will work? Thank you!
basicly whenever the user presses E and isnt selecting any textboxes make a request towards the server with some information that the client has send, for exaple the vehicle the user wants to enter.
the server’s goal is to check if the user is within range and if the desired position isnt occupied.
Get the magnitude between the interaction part and the character’s HumanoidRootPart.
Check if the magnitude is greater than or equal to a set number, for example, 4.
If it is, make your BillboardGui enabled (I suggest using a BillboardGui rather than a ScreenGui being constantly updated, as it will skip around and is not appealing.)
Check for a Keyboard Input while the magnitude is greater than/equal to your number, check if the KeyCode is E, etc.
If so, fire a RemoteEvent to do whatever you’d like to happen on the server, or possibly on the client, in which you wouldn’t use a RemoteEvent.
In the case you are using a RemoteEvent, make sure you add server-side security so exploiters cannot fire it from a distance.
One more thing: make sure you are setting the BillboardGui to Enabled.false when the player is out of range, otherwise it will still show up when the player walks away.
I also recommend disabling this if a player is sitting.