Your First Instance
Creating the base
Section titled “Creating the base”The base of your instance, only a few steps are needed to do so:
-
Create a
Modeland add the TagLB_Systemto it.We will name it “System” for the sake of this guide, but any name works
IMAGE SHOWCASE HERE
-
Create another
ModelcalledLightsinside of theModelcreated on step 1.
Creating a simple light
Section titled “Creating a simple light”Now that your instance is able to be initiated, you won’t see much during play-testing.
To fix that, lets add a simple light that switch between red and blue every 0.5 seconds
Inside of your Lights Model, create a Part (anchor it too) and add the tag LB_Lighto to it
We will name it “Light 1”, but any name works as always
- Add a
String Attributeto said part named “Type” - Set this attribute to “Part”
there are multiple types to choose from, read about it here (not ready yet sorry !).
For the sake of this guide, we will be using the Part type.
IMAGE SHOWCASE HERE
Scripting the light
Section titled “Scripting the light”Now that the light is setup, we can finally script it.
To do so, create a Folder called Modules.
This folder is what will store all of our pattern scripts.
From this folder, we can create a ModuleScript inside of it. (the name does not matter)
From here, add the following lines first
Environment, ELS, self = {}, {}, {}
ELSLocation = scipt.Parent.Parent.LightsThis will give LightBorn the required values it needs to start the module
Now that we have this, let’s make the light works by adding the following
function self.Stage_0() Environment.Enable(ELS["Light 1"], "Red") task.wait(0.5) Environment.Enable(ELS["Light 1"], "Blue")endThis function tells the system to switch the light between red and blue every 0.5 seconds when the stage is set to 0.
Finally we can return the module by doing the following
return function() return selfendThe final product would look like this
Environment, ELS, self = {}, {}, {}
ELSLocation = scipt.Parent.Parent.Lights
function self.Stage_0() Environment.Enable(ELS["Light 1"], "Red") task.wait(0.5) Environment.Enable(ELS["Light 1"], "Blue")end
return function() return selfend