Skip to main content

Creating the adorning script

The adorner itself is a module, which means that you shouldn't edit it directly. Instead, you should create your own script that interacts with it.

Technical summary, read the example instead if you're a non-techy person

The module contains one method: :Adorn. It takes 4 arguments:

  • frame, the frame (instance) you're trying to display on the screens
  • surfaces, a table of SurfaceGUIs
  • topmarker, either a Vector3 or a number indicating the top point of the screens
  • totalFrameSize, a UDim2 describing the total size of the screen in pixels

Example usage:

local adorner = require(script.Parent.Adorner)

local screens = {workspace.Screen1.SurfaceGui, workspace.Screen2.SurfaceGui, workspace.Screen3.SurfaceGui}

adorner:Adorn(script.Frame, screens, workspace.TopMarker.Position, UDim2.fromOffset(2075, 1025))

Example

Continuing the example from the previous pages, let's add a script in ServerScriptService and name it AdornScript. The name is not important, but it's good practice to name thing according to what they do.

Before we actually write the code, let's add a Frame to that script. This frame is what will be displayed on the screens. You don't really have to edit anything about it except for the Size property. Set the Size to {1, 0},{1, 0} to make sure it's stretched correctly.

Let's get back to the script. First we need to include the adorner module in our script. This is done by including this line:

local adorner = require(game.ServerScriptService.Adorner)

Next, let's make a list of all screens in the game, so the adorner knows which screens to affect. We have 3 screens named Screen1, Screen2 and Screen3. All of them are directly under Workspace. One thing you should note is that the adorner needs the SurfaceGuis, not the screen parts. Knowing all of that, the next line of our script looks like this:

local screens = { workspace.Screen1.SurfaceGui, workspace.Screen2.SurfaceGui, workspace.Screen3.SurfaceGui }

One more thing we need to calculate before finishing the script is the total size of our 2D canvas. It's not infinite after all. In our example the screens are all lined up nicely, so we can just temporarily create a new part that's the size of all screens combined and check its size. The part is 41.5 studs wide and 20.5 studs tall, so the total size of our canvas is 50 times bigger, which is 2075 by 1025 pixels.

Lastly, we need to actually tell the adorner to do its thing. We'll be running the :Adorn method, which needs the frame that should be shown on all screens (we'll use the frame we added just a minute ago). It also needs a list of all screens which we have prepared above, the position of the top marker and the total size of the 2D canvas. The actual line of code looks like this:

adorner:Adorn(script.Frame, screens, workspace.TopMarker.Position, UDim2.fromOffset(2075, 1025))

In the end, our script looks like this:

local adorner = require(script.Parent.Adorner)

local screens = {workspace.Screen1.SurfaceGui, workspace.Screen2.SurfaceGui, workspace.Screen3.SurfaceGui}

adorner:Adorn(script.Frame, screens, workspace.TopMarker.Position, UDim2.fromOffset(2075, 1025))

If you did everything correctly, then you should see a white frame on your screens when you start the game. Anything you put in the frame in your script will be displayed on all screens.