Skip to main content

Controlling with scripts

info

Controlling GLights with scripts does require some scripting knowledge

The simplest way to control GLights using scripts is to require the panels module and use its .Run or .RunGroup functions.

How to use GLights in your code

To use GLights in your scripts, include this line of code at the top of your script:

local GLights = require(workspace.GLights.Scripts.Panels.Panel)

After that, if you want to turn on the lights, you can run:

GLights.Run("Strobes", "On")

Strobes in this case is the name of the folder that contains the lights you want to affect.

If you want to only affect a specific group in that folder, for example only the A group, you can run:

GLights.RunGroup("Strobes", "A", "On")

Selectors

Before we continue with a full list of all functions, please note that some of them allow you to specify which numbered groups are affected by providing one more parameter. For example, if you wanted to only turn on lights named Fix1, you could run:

GLights.Run("Strobes", "On", 1)

or if you wanted to only turn on the odd numbered groups:

GLights.Run("Strobes", "On", "Odd") -- change "Odd" to "Even" to affect even-numbered lights

You can use All as well to influence all lights, but that's not neccessary

GLights.Run("Strobes", "On", "All")

Functions that support selectors will be marked with -- *

List of all functions

Here's a list of all functions you can run, Strobes is an example folder.

On / off

To turn lights on run

GLights.Run("Strobes", "On") -- *

To turn lights off run

GLights.Run("Strobes", "Off") -- *

To fade lights on or off, replace On or Off with FadeOn or FadeOff

GLights.Run("Strobes", "FadeOn") -- *
GLights.Run("Strobes", "FadeOff") -- *

To reset or hard reset the lights, run

GLights.Run("Strobes", "Reset")
GLights.Run("Strobes", "HardReset")

Resetting the lights will turn them off and turn off all cues, hard resetting will reset everything

Colours

To turn the lights a certain colour, run

GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0)) -- *

where 255, 128 and 0 are R, G and B

If you want to use a gradient colour, you need to provide the entire colour sequence, for example:

GLights.Run("Strobes", "Color", ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(0, 255, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 255))
})) -- *

You can force smooth color to be on or off for a single color change by adding a false or true at the end. Note that you must add a selector if you choose to do this

GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0), "All", true) -- will force smooth color
GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0), "All", false) -- will force no smooth color

To change the secondary colour used in colour cues, run

GLights.Run("Strobes", "SetGlobalCueSetting", "SecondaryColor", Color3.fromRGB(255, 0, 0))

Cues and actions

To turn on a cue, run

GLights.Run("Strobes", "Cue", "CUE_NAME", true)

To turn off a cue, run

GLights.Run("Strobes", "Cue", "CUE_NAME", false)

Replace CUE_NAME with the name of the cue

Click here for a list of all cue names
  • Strobe
  • Random
  • FadeRandom
  • BumpRandom
  • OldRandom
  • State.Cue1
  • State.Cue2
  • State.Cue3
  • State.Cue4
  • State.Cue5
  • State.Cue7
  • State.Cue8
  • State.Cue9
  • State.Cue10
  • State.Cue11
  • State.Cue12
  • Color.ColorCue1
  • Color.ColorCue2
  • Color.ColorCue3
  • Color.ColorCue4
  • Color.ColorCue5
  • Position.Tilt
  • Position.SlowTilt
  • Position.SmoothTilt
  • Position.RandomTilt
  • Position.Pan
  • Position.SlowPan
  • Position.SmoothPan
  • Position.RandomPan
  • Position.Circle
  • Position.RandomCircle
note

Cue6 is not a cue, but an action

To change the amount of numbered groups affected by Cue3, run

GLights.Run("Strobes", "SetCueSetting", "Cue3", "Groups", 3)

Replace 3 with the amount of groups

To run an action, run

GLights.Run("Strobes", "Action", "ACTION_NAME", ...)

Replace ACTION_NAME with the name of the action and ... with any additional parameters

Click here for a list of action names and their parameters
  • Flash
  • ColorFlash,
  • Cue6, replace ... with true to run it in reverse
  • CustomPositions.Cross, replace ... with true to run it in reverse
  • CustomPositions.In, replace ... with true to run it in reverse
  • CustomPositions.Wide, replace ... with true to run it in reverse
  • CustomPositions.UD, replace ... with true to run it in reverse

Motors

To tilt or pan the lights, run

GLights.Run("Strobes", "Tilt", 50) -- *
GLights.Run("Strobes", "Pan", 50) -- *

Replace 50 with degrees

To change the motor speed, run

GLights.Run("Strobes", "MotorSpeed", 0.01)

Replace 0.01 with the new motor speed, the buttons on the panels are set to:

  • Freeze - 0
  • SS - 0.001
  • S - 0.005
  • M - 0.01
  • F - 0.05

Beam controls

To change the beam mode, run

GLights.Run("Strobes", "BeamMode", "Beam")

Beam can also be NoBeam or Gobo

To change beam thickness or gobo spread, run

GLights.Run("Strobes", "BeamThickness", 0.5)
GLights.Run("Strobes", "GoboSpread", 0.5)

0.5 means 50% of the original width or spread

To enable or disable gobo rotation, run

GLights.Run("Strobes", "RotateGobo", 1) -- *
GLights.Run("Strobes", "RotateGobo", 0) -- *
GLights.Run("Strobes", "RotateGobo", -1) -- *

1 will rotate the beams in one direction, -1 in the other and 0 will stop them

Modifiers

To change cue sped or fade speed, run

GLights.Run("Strobes", "CueSpeed", 0.5)
GLights.Run("Strobes", "FadeSpeed", 0.5)

0.5 means half of the original speed

To enable looping cues, smooth colour, animated gradients, overshoot or group random, run

GLights.Run("Strobes", "LoopCues", true)
GLights.Run("Strobes", "SmoothColor", true)
GLights.Run("Strobes", "AnimatedGradients", true)
GLights.Run("Strobes", "SetGlobalCueSetting", "Overshoot", true)
GLights.Run("Strobes", "SetGlobalCueSetting", "GroupRandom", true)

Change true to false to disable that modifier

To change the brightness of the lights, run

GLights.Run("Strobes", "Dimness", 0.5)

0.5 means half the brightness, the number shouldn't be higher than 1

Follow spotlights

To follow a part, run

GLights.Run("Strobes", "Follow", workspace.Stacy.HumanoidRootPart)

workspace.Stacy.HumanoidRootPart should be a path to your part

To follow a player, run

GLights.Run("Strobes", "Follow", game.Players.USERNAME.Character.HumanoidRootPart)

To stop following, run

GLights.Run("Strobes", "Follow", nil)

Cheatsheet

All functions
GLights.Run("Strobes", "On") -- *
GLights.Run("Strobes", "Off") -- *

GLights.Run("Strobes", "FadeOn") -- *
GLights.Run("Strobes", "FadeOff") -- *

GLights.Run("Strobes", "Reset")
GLights.Run("Strobes", "HardReset")

GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0)) -- *
GLights.Run("Strobes", "Color", ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(0, 255, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 255))
})) -- *
GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0), SELECTOR, true) -- force smooth color
GLights.Run("Strobes", "Color", Color3.fromRGB(255, 128, 0), SELECTOR, false) -- force no smooth color
GLights.Run("Strobes", "SetGlobalCueSetting", "SecondaryColor", Color3.fromRGB(255, 0, 0))

GLights.Run("Strobes", "Cue", "CUE_NAME", true)
GLights.Run("Strobes", "Cue", "CUE_NAME", false)
GLights.Run("Strobes", "SetCueSetting", "Cue3", "Groups", 3)
GLights.Run("Strobes", "Action", "ACTION_NAME", ...)

GLights.Run("Strobes", "Tilt", 50) -- *
GLights.Run("Strobes", "Pan", 50) -- *
GLights.Run("Strobes", "MotorSpeed", 0.01)

GLights.Run("Strobes", "BeamMode", "Beam")
GLights.Run("Strobes", "BeamThickness", 0.5)
GLights.Run("Strobes", "GoboSpread", 0.5)
GLights.Run("Strobes", "RotateGobo", 1) -- *
GLights.Run("Strobes", "RotateGobo", 0) -- *
GLights.Run("Strobes", "RotateGobo", -1) -- *

GLights.Run("Strobes", "CueSpeed", 0.5)
GLights.Run("Strobes", "FadeSpeed", 0.5)
GLights.Run("Strobes", "LoopCues", true)
GLights.Run("Strobes", "SmoothColor", true)
GLights.Run("Strobes", "AnimatedGradients", true)
GLights.Run("Strobes", "SetGlobalCueSetting", "Overshoot", true)
GLights.Run("Strobes", "SetGlobalCueSetting", "GroupRandom", true)
GLights.Run("Strobes", "Dimness", 0.5)

GLights.Run("Strobes", "Follow", workspace.Stacy.HumanoidRootPart)
GLights.Run("Strobes", "Follow", game.Players.USERNAME.Character.HumanoidRootPart)
GLights.Run("Strobes", "Follow", nil)
All cue names
  • Strobe
  • Random
  • FadeRandom
  • BumpRandom
  • OldRandom
  • State.Cue1
  • State.Cue2
  • State.Cue3
  • State.Cue4
  • State.Cue5
  • State.Cue7
  • State.Cue8
  • State.Cue9
  • State.Cue10
  • State.Cue11
  • State.Cue12
  • Color.ColorCue1
  • Color.ColorCue2
  • Color.ColorCue3
  • Color.ColorCue4
  • Color.ColorCue5
  • Position.Tilt
  • Position.SlowTilt
  • Position.SmoothTilt
  • Position.RandomTilt
  • Position.Pan
  • Position.SlowPan
  • Position.SmoothPan
  • Position.RandomPan
  • Position.Circle
  • Position.RandomCircle
All action names (ones with * can be reversed)
  • Flash
  • ColorFlash
  • Cue6*
  • CustomPositions.Cross*
  • CustomPositions.In*
  • CustomPositions.Wide*
  • CustomPositions.UD*

Examples

A script to start Cue1 in a folder named Washes when a button is pressed could look like this:

local GLights = require(workspace.GLights.Scripts.Panels.Panel)

script.Parent.ClickDetector.MouseClick:Connect(function()
GLights.Run("Washes", "Cue", "State.Cue1", true)
end)

A script to put lights inside of the Beams folder in the reverse Wide position when a button is pressed could look like this:

local GLights = require(workspace.GLights.Scripts.Panels.Panel)

script.Parent.ClickDetector.MouseClick:Connect(function()
GLights.Run("Beams", "Action", "CustomPositions.Wide", true)
end)

A script that would make odd-numbered lights red and even-numbered lights green when a button is pressed could look like this:

local GLights = require(workspace.GLights.Scripts.Panels.Panel)

script.Parent.ClickDetector.MouseClick:Connect(function()
GLights.Run("Strobes", "Color", Color3.fromRGB(255, 0, 0), "Odd")
GLights.Run("Strobes", "Color", Color3.fromRGB(0, 255, 0), "Even")
end)