Skip to content

Your First Instance

The base of your instance, only a few steps are needed to do so:


  1. Create a Model and add the Tag LB_System to it.

    We will name it “System” for the sake of this guide, but any name works

    IMAGE SHOWCASE HERE

  2. Create another Model called Lights inside of the Model created on step 1.

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

  1. Add a String Attribute to said part named “Type”
  2. 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


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.Lights

This 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")
end

This 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 self
end

The 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 self
end