Hello Everybody! I am here to showcase a FREE open source plugin I have created.
The system is very modular and can do almost everything you want it to do. Do you want a E to open door or a E to equip a tool? Well this system can do just that! It is very powerful, and each Interactable Object depends on its own module script.
Examples / Images
- Each Interactable can be both Server or Client Sided.
Door Opening Example:
https://gyazo.com/4098a2bd2ee991c7a9c49c5453def106
Part Color Changer Example:
https://gyazo.com/a40e964787a5b92f938ec856761c1443
Plugin Showcase
Installing the system is as easy as clicking a button, literally.
One click install, easy as that.
When clicking the “Create Interactable Base” button, a slightly transparent part
will be created and placed at the cameras position, and the part can be edited. All it basically does is create a part tagged as “Interactable” with the CollectionService. Here is what the button does:
How it works
Everytime the KeyCode for the interactable button is pushed, it checks whatever is
in front of you and checks if it is tagged as “Interactable”. If it is, it will run the function inside the module code in the interactable. (See Below for the code) The module can be determined as either client or server sided. Which means when the interactable is interacted with, the code will either run on the server, or the client depending on what you choose.
Making custom interactable functions
In the “InteractableExample” module script, there will be a function
named “Subscribe”. That function is highly customizable, because you
can put anything you want in it!
This is what the code of the script looks like:
--// You can use basically any variable you want to, the system is highly expandable
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Interactable = {}
--// Interactable's setup
Interactable.ServerSided = true; --// Determines if Interactable:Subscribe() is ran on server or client.
Interactable.InteractMessage = "Open door" --// The message that pops up when hovering over the object (if you have this enabeled [In Settings])
function Interactable:Subscribe() -- This is the function that is ran when interacted, you can make this function do ANYTHING you want it to do!
--[[
EXAMPLES -->
script.Parent.BrickColor = BrickColor.Random()
ReplicatedStorage.Audio:Play()
]]--
end
return Interactable
Source Code → https://github.com/PolyHall-0/InteractionSystem
If you want to support me to make more systems such as this, please go here
Thank you!!