E key that trigger an event when the player is near a part

the title was an example , but is there any ways to show a billboard gui when the player is near a part and if we press a key , it fires a remote event.


You could try making an invisible part around that part, so when player touches the invisible part, billboard GUI will show up and you will be able to press the key.

Have you tried getting the distance from the character?

Or you can calculate it yourself,
local function distance(vec1,vec2)
return (vec1-vec2).Magnitude

Adding to what @Halalaluyafail3 said, All you have to do is Listen for an InputBegan event, making sure that its the right keybind, Checking if the player is near that part by calculating the magnitude. A simple example would be:

local  UIS =  game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
 if input.KeyCode == Enum.KeyCode.X and not gpe then -- X is just an example change it to whatever you want.
   if (plr.Character.HumanoidRootPart.Position - yourPart.Position).magnitude <= 10  then -- 10 is the distance in studs 
-- you can fire your event here to handle it.

Have you tried using ContextActionService?
ContextActionService allows you to only have the function fire when the key you want is pressed, and it also makes it simpler to have it not fire when they are typing in a textbox.

i already did something like that but i was searching and there are not much other solutions ,thanks anyways !