Interaction System Improve code

Place file: Interaction System_Code-Review_Fixed.rbxl (23.8 KB)

The code fires different BindableEvents based on which part you press E close to, I’m not satisfied with the customizability of my current system and would like to improve that to make the code reusable for other games.

I have considered an option to make the BindableEvent Fire only when E has been held down for a certain amount of time

I want to improve my code by making it cleaner and more customizable.

1 Like

Take advantage of the collection service and store things you can interact with into an array and get the nearest one, check if its at hand-distance and if E is pressed at any point and such thing to interact with exists, fire it to the server and from there the server should parse the Tags and return the client a variety of options (depending on the tags the instance has) on what to do with such interactable instance.

That’s exactly what I’m doing?

All Interactions might not need the server to do something.

Edit: I’m currently having InteractionSystemClient listen to BindableEvents and firing a RemoteEvent with the Part as a parameter if necessary, the server then checks if the part actually has a reference to that RemoteEvent and checks the Characters distance from the Part, forgot to include that in the place file.

Edit 2: I changed the place file in the original post to one that includes the Server stuff I forgot