Players often enjoy feeling like they’re a part of constructing the space they’re in. The SurfaceArt developer module lets players literally leave their mark in an experience.
To use the SurfaceArt module in an experience:
- Visit the SurfaceArt marketplace page, click the green Get button, and confirm the transaction.
- In Studio, open the toolbox (View → Toolbox).
- Select your toolbox Inventory section.
- Locate the module item and click it or drag-and-drop it into the 3D view.
- In the Explorer window, move the entire SurfaceArt folder into ServerScriptService. Upon running the experience, the module will distribute itself to various services and begin running.
Advanced Installation Options »
This and other developer modules come with an Install script that runs the installer and distributes the contents of the module to the same services that the folders are named after.
The Install script can be utilized as follows:
EnableLogging — Set to
true to enable debug logging for the current developer module. This lets you see how the module gets distributed, along with how each package is linked.
InstallStarted — Fires when the installer first starts up. You can hook into this event to run any pre-install steps.
InstallFinished — Fires when the installer has finished installing the module. By this point, the contents of each service folder has been distributed. You can also hook into this event to run any post-install steps.
Instance/Destroy|Destroy()run on it immediately after this event is fired.
Install() — Installs the given developer module by overlaying each of the service folders over existing services. For example, a folder named ReplicatedStorage containing a SurfaceArt script will be distributed to
game.ReplicatedStorage.SurfaceArt when installing.
Positioning the Canvas
The module comes with one SurfaceCanvas model that you can position in the 3D world. This model is what players will interact with to place art on its surface.
- Locate the SurfaceCanvas mesh inside the Workspace folder of the module’s main folder.
- Move it into the top-level Workspace hierarchy and position it where desired.
- Upon publishing/running a test session, players will be able to interact with the object via a
ProximityPromptand place art on the defined surface.
It is not required that you use the packaged mesh for placing art. The module uses
CollectionService to locate parts tagged as SurfaceCanvas and make them operate as canvases. Any tagged canvas must be a
BasePart and it should have an
articles/instance attributes|attribute defining the surface face as outlined in Changing the Canvas Face.
Changing the Canvas Face
Under the hood, the module uses a
SurfaceGui to display art items. To configure which surface the art appears on:
- Select the SurfaceCanvas mesh.
- At the bottom of the Properties window, locate the SurfaceCanvasFace attribute with a default value of Right.
- Click the attribute and enter one of six values that describe a
|Attribute Value||Corresponding Normal ID|
Using Custom Art Assets
To better fit the theme of your experience, you may use your own set of custom assets instead of the defaults. This can be done via the configure() function, called from a
Script in ServerScriptService.
Clearing All Canvases
To remove all existing art from all canvases in the world, call the removeAllArt() function from a
Showing Custom Effects
There may be cases where you’d like to include additional visual effects when an artwork is placed. This module exposes an event called artChanged on the client that you can connect to and add your own logic.
Images to be used as art for the canvas are represented by a table with two values.
|name||Metadata display name.|
|assetId||Asset ID of the image to include.|
Overrides default configuration options. This function can only be called from a
|enabled||Toggles the module's functionality on or off.||true|
|assets||List of SurfaceArtAsset types.||(see code)|
|quotaPerPlayer||Maximum number of art pieces that can be placed by each player.||2|
|rowsPerCanvas||Number of rows in the canvas grid.||2|
|colsPerCanvas||Number of columns in the canvas grid.||5|
|itemsPerPage||Number of items to skip when paging left and right.||3|
|promptImage||Icon shown in the proximity prompt to enter art selection view.||"rbxassetid://8076723774"|
|promptKeyCode||Keyboard shortcut used to activate the prompt to enter art selection.||Enum.KeyCode.E|
|promptRequiresLineOfSight||Boolean value that determines if the proximity prompt has to be in line of sight between user and canvas.||true|
|promptMaxActivationDistance||The maximum distance a player's character can be from the canvas for the prompt to appear.||10|
|promptExclusivity||Determines which prompts can be shown at the same time. See
|canvasPaddingLeft||Left padding for the surface canvas.||UDim.new(0, 8)|
|canvasPaddingRight||Right padding for the surface canvas.||UDim.new(0, 8)|
|canvasPaddingTop||Top padding for the surface canvas.||UDim.new(0, 8)|
|canvasPaddingBottom||Bottom padding for the surface canvas.||UDim.new(0, 8)|
|leftArrowPageImage||Image for the left arrow to flip to the previous page.||"rbxassetid://6998633654"|
|leftArrowItemImage||Image for the left arrow to select the previous art item.||"rbxassetid://8072765021"|
|rightArrowPageImage||Image for the right arrow to flip to the next page.||"rbxassetid://6998635824"|
|rightArrowItemImage||Image for the right arrow to select the next art item.||"rbxassetid://8072764852"|
|usePageHotkeys||Whether page hotkeys are used. If true, nextPageKey and prevPageKey are used to cycle between pages.||true|
|nextPageKey||Key used to cycle to the next page of artwork.||Enum.KeyCode.E|
|nextItemKey||Key used to cycle to the next item of artwork.||Enum.KeyCode.Right|
|prevPageKey||Key used to cycle to the previous page of artwork.||Enum.KeyCode.Q|
|prevItemKey||Key used to cycle to the previous item of artwork.||Enum.KeyCode.Left|
Places an art piece programmatically on behalf of a player. Note that the
canvas object must be tagged with the SurfaceCanvas tag when the server is initialized. It is recommended to use this only with a canvas returned from getCanvases().
Fires when an artwork is changed at a particular location on a canvas. When an artwork is removed,
artId will be
nil. Note that a
datatype/Vector3 value is passed as the third parameter to the event handler so that you can position a custom effect at the exact position where the artwork is placed. This event can only be connected in a
Fires when a canvas interaction prompt is shown to a player. The connected function receives the canvas on which the prompt is showing. This event can only be connected in a
Fires when a canvas interaction prompt is hidden. The connected function receives the canvas on which the prompt was showing. This event can only be connected in a
Fires when the surface art selector UI is shown to a player. This event can only be connected in a
Fires when the surface art selector UI is hidden for a player. This event can only be connected in a
Previous Photo Booth Next Scavenger Hunt