ScriptAPI source

Working Examples

Browse practical scripts for interaction, triggers, dialogs, players, character physics, media, lights, materials, audio, animation, spritesheets, spawning, sitpoints, script events, and chat commands. Code blocks are loaded from the raw .cs files in this folder.

ScriptAPI / Examples

Example Index

These examples are given to show acceptable patterns for user-uploaded scripts on the AdmazoVerse platform. The current script API is the very first version, and alot more system object types and features will be added soon. If you are searching for something specific, use the filter search box below to narrow the examples list shown below.

AI NPC / Conversation

AiNpcControl

A talking, listening, walking AI NPC: wears one of your saved outfits, follows players, and holds a spoken conversation powered by your own Claude or ChatGPT key (a [Secret] field, stored server-side only). Click it for a Follow me / Interact menu.

Raw .cs
Loading AiNpcControl.cs...

Data Store / Persistence

DataStoreCounter

A world-wide click counter whose total survives restarts and rebuilds, saved in the server's database with SaveData / LoadData. The storage key is prefixed with a [Secret] field so it never ships to players. See the Data Store reference.

Raw .cs
Loading DataStoreCounter.cs...

Dialogs / Callbacks

DialogDemo

Shows success and error dialogs, including an OK/Cancel result callback.

Raw .cs
Loading DialogDemo.cs...

Dialogs / Target Users

TargetedDialogCallback

Targets a dialog at a named user and handles the selected button result.

Raw .cs
Loading TargetedDialogCallback.cs...

Interaction / Self Object

InteractableSelf

Makes the script object clickable and shows a dialog when a user interacts with it.

Raw .cs
Loading InteractableSelf.cs...

Objects / SceneObject

SceneObjectReference

Uses a SceneObject field, hides its renderer, and reports the target id.

Raw .cs
Loading SceneObjectReference.cs...

Objects / Per-User Visibility

RendererVisibleForUser

Makes a slotted button interactable and toggles a target renderer independently for each user. Private visibility resets when the user rejoins.

Raw .cs
Loading RendererVisibleForUser.cs...

Objects / Smooth Moving Lights

LightControlLerp

Runs multi-light dance patterns with timed rotation waypoints. The server sends only a modest number of commands while each client and the shared instance interpolate smoothly between them.

Raw .cs
Loading LightControlLerp.cs...

Objects / Directional Lights

DirectionalLightSwitch

Uses a slotted button to switch a directional light on and off, then sends the current shared light state to joining users.

Raw .cs
Loading DirectionalLightSwitch.cs...

Materials / Emission Lists

MaterialEmissionListDemo

A glow switch: click a button and the chosen objects (with everything inside them) fade into a glow, click again and they fade out. Pick the colour, strength and fade time in the Inspector; optionally a colour per object. Uses SetObjectGlow / ClearObjectGlow.

Raw .cs
Loading MaterialEmissionListDemo.cs...

Media / URL

MediaScreenUrl

Registers a click target and changes a media screen URL for one screen id or all screens.

Raw .cs
Loading MediaScreenUrl.cs...

Media / Per-User URL

PrivateMediaScreenChat

Adds a /privatevideo <url> or /privatevideo <screenId> <url> chat command that changes what the media screens show for the player who typed it only (/yt is the built-in command that changes them for everybody). The command name can be changed in the Inspector.

Raw .cs
Loading PrivateMediaScreenChat.cs...

Players / Emotes

PlayerEmoteControl

Toggles an emote on the person who clicks, everyone, or a named user. Pick the emote in the selectedEmote dropdown in the Inspector: it lists your own emotes, uploaded or bought in the Avatar Editor.

Raw .cs
Loading PlayerEmoteControl.cs...

Players / Avatar Clones

AvatarCloneControl

Spawns a server avatar clone by username (in one of their outfits by name, or the one they wear), toggles the emote picked in its selectedEmote dropdown, drops it as a ragdoll and stands it back up, slots it into a sitpoint, and destroys it through the cached clone reference.

Raw .cs
Loading AvatarCloneControl.cs...

Players / Scale

PlayerScale

Interactable that toggles scale for the clicking user, everyone, or a named target.

Raw .cs
Loading PlayerScale.cs...

Players / Name Tags

NameTagToggle

A /nametags chat command that shows or hides player name tags for everyone, or for one named player.

Raw .cs
Loading NameTagToggle.cs...

Players / Character Physics

CharacterPhysicsModes

Player ragdolls: a Drop button (with an optional push) and fall trigger zones turn the player into a ragdoll that falls onto whatever is below; a Stand button and recover timers get them up again. Ragdoll strength, gravity, drag, friction and bounce are set in the Inspector. Optional audio object slots.

Raw .cs
Loading CharacterPhysicsModes.cs...

Users / Lifecycle

UserJoinPart

Overrides user join and part callbacks for simple presence logging.

Raw .cs
Loading UserJoinPart.cs...

Users / Enumeration

ForEachUser

Runs a repeating coroutine that logs active users through ForEachUser.

Raw .cs
Loading ForEachUser.cs...

Script Events / Sender

PostScriptEventsSender

Posts global and grouped script events with structured name/value data.

Raw .cs
Loading PostScriptEventsSender.cs...

Script Events / Receiver

PostScriptEventsReceiver

Listens to global and grouped script events and reads typed payload values.

Raw .cs
Loading PostScriptEventsReceiver.cs...

Chat / Slash Commands

ChatCommandRouter

Listens for a custom slash command, reads the sender and arguments, and adds a [Script] chat response.

Raw .cs
Loading ChatCommandRouter.cs...

Triggers / Self Object

TriggerSelf

Registers enter and exit callbacks on the script object.

Raw .cs
Loading TriggerSelf.cs...

Triggers / Target Object

TriggerSceneObjectSlot

Registers enter and exit callbacks on a SceneObject trigger slot.

Raw .cs
Loading TriggerSceneObjectSlot.cs...

Triggers / Audio

NamedTriggerSoundOnce

Plays a target audio source when a matching object enters a trigger, with name filtering and cooldown.

Raw .cs
Loading NamedTriggerSoundOnce.cs...

Triggers / Reset

ResetTrigger

Resets players with TeleportPlayer and dynamic rigidbodies with transform client commands.

Raw .cs
Loading ResetTrigger.cs...

Audio / Collisions

CollisionVelocitySound

Plays an impact sound when objects bump into each other, higher the faster they meet. Put it on a moving physics object, or on a still object (a wall, a bell) that physics objects hit. Hits on objects whose name contains a word you choose can play a different sound. Uses RegisterCollision.

Raw .cs
Loading CollisionVelocitySound.cs...

Animation / Legacy Control

Rollercoaster1

Controls a legacy Animation with synced random frame, play, stop, and reset (back to frame 0) interactions. Up to two cart sounds (objects with an Audio Source inside the carts) are pitched by how fast their cart moves with SetAudioPitchByMotion: silent and low when the ride stands still, higher the faster it goes.

Raw .cs
Loading Rollercoaster1.cs...

Spritesheets / Hints

Spritesheet

Variant of the spritesheet button example with interaction hint text.

Raw .cs
Loading Spritesheet.cs...

Models / Blend Shapes

Blend Shape Control

Buttons that play, stop, loop, speed up and set the resting value of a model's blend shape (morph target), the same for everyone in the world and for players who join later.

Raw .cs
Loading BlendShapeControl.cs...

Inventory / Spawning

InventorySpawner

Spawns an inventory item from a click target, caps total spawned objects, and despawns after a timeout.

Raw .cs
Loading InventorySpawner.cs...

Inventory / Backpack

Backpack

A sandbox backpack: a Backpack button on every player's control bar opens a panel of your items (icon and name each); picking one spawns it in front of that player. Per-player limit, optional auto destroy, items removed when their player leaves. Meshes and prefabs work, including rigidbodies and scripts on them.

Raw .cs
Loading Backpack.cs...

HUDs / Spawning

HudSpawner

A spawner HUD (CreateHud). Players click a cube in the scene (MakeInteractable) to get it (hud.Show): their HUDs button appears on the control bar and their HUD view opens. It has a title in your colour, an optional logo and background picture, your font (a HudFont dropdown in the Inspector), a button per item (with its icon and name), a How Many dropdown, a Cooldown slider and a bar that fills while the player waits. Each player's HUD is their own: their dropdown pick, their slider and their cooldown bar never change anyone else's (GetSelectedText(username), GetValue(username), SetValue(value, username)). Fill the Items, Icons and Names lists in the Inspector (entry #N of each belongs together).

Raw .cs
Loading HudSpawner.cs...

Panels / Overlay

PanelScoreboard

A custom UI panel (CreatePanel) shown as a screen overlay: it sits in a corner behind the platform's own UI, visible to everyone (SetMode(PanelMode.Overlay), ShowToEveryone). It shows a shared round score every player sees the same, a coin count that is each player's own (AddCounter with an icon), and a Collect button. A click comes back to the server script as that player (PanelEvent.Username): their coins go up for them only (SetText(text, username)), the shared total goes up for everyone, and both update live on every screen. This is the difference from a HUD: a HUD is the player's personal window, a panel is the world's own UI surface.

Raw .cs
Loading PanelScoreboard.cs...

Panels / World-space

PanelWorldMenu

The same panel system shown in world-space, so it works in VR as well as on desktop and mobile. It stands in the world on a flat surface: float it above an object (PlaceOnObject) or stand it at a spot (PlaceInWorld), optionally facing each viewer. It has buttons, a per-player volume slider, a shared lights toggle, a category dropdown and an inventory grid of things to pick (AddInventory / PanelCell); every pick comes back as that player with the cell index. It can also mirror a painted object live with AddLiveTexture (point it at the object a script canvas, CreateCanvas, is painted on).

Raw .cs
Loading PanelWorldMenu.cs...

Panels / Overlay

PanelCounter

The simplest custom panel (CreatePanel): just an icon and a number floating on screen with no card behind it (SetBackgroundColor(Color.clear)). Every time the object the script is on (or ClickTarget) is clicked by any player, the number goes up for everyone at once, and players who join later see the current number. Place it anywhere with SetScreenPosition(ScreenX, ScreenY, Pivot) — ScreenX / ScreenY are a percent of the screen's width and height, and Pivot (a PanelAnchor) is which point of the panel lands there. Good for a shared tally, a team score or a collectible count.

Raw .cs
Loading PanelCounter.cs...

Players / Visibility

PlayerVisibility

Click a cube to turn invisible (HidePlayer): everybody else stops seeing your avatar, name tag and voice meter, players who join later too, and you stay invisible when you change outfits. You still see yourself, faded like a ghost, unless See Yourself is off (hideFromSelf). While invisible you get an Appear button (ShowActionButton: on screen, G on desktop, right stick click in VR); clicking the cube again, the button, or the optional timer (Vanish For Seconds) brings you back (ShowPlayer). Optional: an Everyone Button object that hides or shows every player at once, and the /vanish and /appear chat commands.

Raw .cs
Loading PlayerVisibility.cs...

Store / Links

StoreOffer

Sells one store item right in the world (OfferStoreItem): click a sign or a mannequin and a buy panel opens (desktop, mobile and VR) with the item’s picture, name, creator, price and your balance. Buy is a real store purchase and the item goes straight into your inventory, with a message that it was delivered. In the Inspector choose the Store the item is sold in (Scene = Scene Editor store, Avatar = Avatar Editor store) and paste the Item: its store id, or its store link (a private item needs its private link). Optional: an Everyone Button that offers it to everybody in the world, Offer When Players Arrive, and a thank-you in chat (StoreOfferResult).

Raw .cs
Loading StoreOffer.cs...

LinkOffer

Click it to be asked whether to open a web page in a new tab (OfferLink). The player sees the address first; nothing opens unless they choose Open Link.

Raw .cs
Loading LinkOffer.cs...

Notifications

Toast

Click it to get a notification card (ShowToast) at the top right of the screen, on desktop, mobile and in VR: an icon on the left (drop a texture from your inventory on Icon), a title and a description beside it. It shows for 10 seconds; text that does not fit the card is cut and ends with ... Everyone Button (optional) shows it to everybody in the world at once (ShowToastToEveryone).

Raw .cs
Loading Toast.cs...

Weather

WeatherControl

Changes a dynamic sky's weather for everybody in the world (SetWeather; the scene's Sky must be Dynamic sky in Scene Settings): click it and the sky blends to the chosen Weather over Blend Seconds. Optional buttons put the usual weather back (ClearWeather), make lightning strike (TriggerLightning), and switch between night and the scene's own time (SetTimeOfDay / ResetTimeOfDay).

Raw .cs
Loading WeatherControl.cs...

Quests

Quest scripts

Quests are set up in the Scene Editor (Windows → Quests) and work without any script: players get them when they arrive, from the Quests panel, by clicking an object or walking into an area; tasks are clicking or picking up objects, or walking into areas. These small scripts add more: a quest giver with a marker, pick-ups and trigger areas for tasks “Done by a script”, objects that appear with quest progress, and rewards. Each names its quest (and task) by the title used in the Quests window.

QuestGiver

Click a character (or a sign) to be offered a quest; an optional marker shows only to players who have not taken it yet.

Raw .cs
Loading QuestGiver.cs...

QuestItem

Click it, or pick it up if it is Grabbable, to count towards a task that is “Done by a script” (collect 5 coins). Each player collects it once; clicked items hide for that player.

Raw .cs
Loading QuestItem.cs...

QuestArea

A trigger: walking in completes a task, or offers the quest.

Raw .cs
Loading QuestArea.cs...

QuestVisibility

Shows an object only to players who got far enough in a quest (a treasure chest when it is completed).

Raw .cs
Loading QuestVisibility.cs...

QuestRewards

Celebrates finished quests: a chat announcement and a short glow (ListenForQuests, TintPlayer).

Raw .cs
Loading QuestRewards.cs...

Sitpoints / Occupancy

SitpointDetection

Responds to user sit and stand events for a watched sitpoint.

Raw .cs
Loading SitpointDetection.cs...

Sitpoints / Input

SitpointVehiclePrototype

Registers sitpoint input and applies movement forces to build a prototype vehicle controller.

Raw .cs
Loading SitpointVehiclePrototype.cs...

Sitpoints / Vehicles

HelicopterVehicle

A 4-seat flying helicopter: the pilot seat flies it with sitpoint input (forces on a Rigidbody), passengers board by clicking the hull (SeatPlayer), boarding is switched on or off per player (SetInteractable), blade speed is shared animation state and the engine sound is pitched by motion.

Raw .cs
Loading HelicopterVehicle.cs...

Sitpoints / Vehicles

LandVehicle

A 4-seat car: the driver seat drives it with sitpoint input (forces on a Rigidbody), passengers board by clicking it (SeatPlayer), boarding is switched on or off per player (SetInteractable), it rights itself past a set tilt, and an optional Drifting toggle chooses between grippy and sliding handling. The four wheels can be parts of an imported model (pick them in the Hierarchy): they roll with the speed and the front two steer, sent with LerpLocalRotation. The engine sound is pitched by motion, and up to two exhaust Particle Systems smoke more the faster it goes (SetParticleEmission, SetParticlesPlaying). Turn on LeanIntoTurns for a motorcycle or bike that banks into turns from the bottom up: it sets the CenterOfGravity vector on the Rigidbody and leans with LeanAmount (X = how many degrees it rolls left/right into a turn). Off by default, so cars and trucks stay flat.

Raw .cs
Loading LandVehicle.cs...

Water / Vehicles

BuoyantBoat

A boat (or a crate, a buoy, a cube) that floats on a Water System and rides the waves in sync for every player. MakeBuoyant sets how low it sits (SinkDepth), how much it follows the wave height (Bob) and how much it leans with the slope (Tilt); the waves come from the room’s shared clock, so everyone sees the same swell. It stays where you put it: the water only moves it up and down and leans it, so its position and heading stay yours to drive (a player-controlled boat rides the swell the same way). Tick Drift to watch it sail a slow circle. Slot the Water System object to change the waves from the script (SetWaterWaves, SetWaveHeight, SetWaveSpeed, SetWaveSteepness) and try the chat commands /calm, /storm, /waveheight 1, /sink 0.4, /tilt 1.

Raw .cs
Loading BuoyantBoat.cs...

Physics / Grabbing

GardenHose

A straight hose mesh becomes a rubber hose from a reel to a nozzle players can pick up (MakeHose). It hangs, bends (Stiffness), stretches when pulled (Stretch, MaxStretch), lies on the ground and slides over the world’s colliders, and the end follows the player’s hand. Let go of the nozzle and it goes back on its hook after ReturnDelay seconds (ListenForGrab, GetHolder). Offsets put each end on a point of its object, and NozzleDirection makes the hose leave the nozzle straight out of its back. Chat commands: /hose drop (DetachHoseEnd), /hose attach and /hose hook (SetHoseEnd), /hose stiff 0.6, /hose stretch 0.5, /hose slack 1.6, /hose off (StopHose), /hose on.

Raw .cs
Loading GardenHose.cs...

Canvases / Painting

SpinArt

A carnival spin-art machine, painted with a script canvas (CreateCanvas): click a colour button to squeeze paint onto the paper (it waits in wet puddles), spin it, and each puddle bursts into curved streaks that thin out, split and end in beads and splatter, different every time (Dot, Line, Border). The paper turns with the script (LerpLocalRotation) or with its own animation, played once per spin (SpinWithScript off). Start, Stop, Reset and up to seven colour buttons are any objects made clickable with MakeInteractable. Each colour can also have a bottle (any scene object: a group, an animated mesh, particles, a light) that is hidden at start, shown to everybody while that colour is squeezed with its animation played once, then hidden again (SetObjectVisible). Up to three squirt sounds play one at random with each squirt (PlayAudioFrom). A spinning sound plays over and over while the paper turns and stops with it (PlayAudioLoop, StopAudio). Everybody sees the same picture being made, also players who arrive half-way. TransparentBackground makes the paper see-through, so only the paint (and the border) shows.

Raw .cs
Loading SpinArt.cs...

Canvases / Players

Footprints

Footprints in the sand, painted with a script canvas: every player who walks over the floor leaves a trail of left and right prints where their feet come down, pointing the way they face (GetUsers with each player's Position, Forward, Speed, IsRunning and IsGrounded). The prints are pictures from your inventory stamped onto the canvas (canvas.Blit, turned and mirrored), or a drawn foot when there are none. Running leaves longer strides, deeper prints and kicked-up sand (or its own running pictures), stopping puts the other foot down beside the last one, and the prints slowly fill in again. A guide helps line the picture up with any floor. Everybody sees the same ground, also players who arrive later. A ready-made footprint picture to import: footprint_left.png (white on see-through, so PrintColor colours it; slot it as LeftFoot and it is mirrored for the right foot).

Raw .cs
Loading Footprints.cs...

Players / Avatars

AvatarPaint

Paint buckets for avatars: whoever clicks a colour button has their whole avatar (body, clothes, hair, everything they wear) turned that colour, as if dipped in paint (TintPlayer), optionally glowing; the reset button washes it off (ResetPlayerTint). Nine colour buttons (the rainbow, white and black, each colour changeable) and a reset button, any objects made clickable with MakeInteractable. Everybody sees it, also players who join later; it lasts until reset, until the player leaves the world, or until the scene changes.

Raw .cs
Loading AvatarPaint.cs...

Canvases / Displays

LEDboard

LED character sprite sheet: 90 characters in one row

LED character sprite sheet for this script: ledboard_spritesheet.jpg (8000 × 119, 90 characters in one row). Upload it to your inventory as a texture and put it in CharacterSheet; SheetColumns 90, SheetRows 1 and Characters (left empty) already match it.

An LED sign on one material: every cell shows a character from an LED sprite sheet (canvas.CreateTileGrid, only changed cells are sent, up to 20 updates a second with SetUpdateRate), in one of 10 colours (0-9, set in the Inspector) and 10 glow levels (0-9). Programs paint text in three sizes, sprites, shapes, borders and sine waves and animate them with loops; they come from the Programs list (shown in turn), from script events (ProgramEvents), when a player arrives (OnJoinProgram), or from moderators in chat. Everybody sees the same board, also players who arrive later.

Set up: put the LED character sheet in CharacterSheet (all characters in one row, 90 frames, in the order of Characters) and choose the board size (Columns × Rows). Add your username to Moderators for the chat commands: /ledeval <program>, /ledstop, /ledreset, /board <text>, /ledautoswitch on|off, /ledonjoin on|off, /ledframerate <seconds>, /leddebug on|off, /addmod <name>, /removemod <name>.

The program language: instructions separated by commas. Values can be sums and use {i}, your own {variables}, {r=1,9} (a random whole number from 1 to 9), {rw} / {rh} (a random column / row), {rc} (a random colour) and {lastuserjoined}.

textdraw(text, size, x, y, colour, glow)

Text: size 1 = one cell per character, 2 = letters 5 cells high, 4 = 8 cells high (made of █). Stays until cleared.

shape(type, width, height, x, y, character, colour, glow)

rectangle, circle, splatter or triangle, filled with the character.

border(solid, characters, colour, glow, animated)

The characters run round the edge; animated moves them along each time it is drawn.

sinewave(amplitude, frequency, speed, character, colour, glow, thickness)

Fills the board with a wave (the rest is cleared); the same call again moves it on.

spritedefine(name, width, height, "pattern")

A sprite: its rows one after another in one string (spaces are see-through when painted with transparent on).

paintsprite(name, x, y, colour, glow, transparent, replace, rotation)

Paints a sprite. transparent (true when left out) skips spaces; replace swaps the sprite's characters for these, in turn; rotation in degrees.

background(stars) / clear()

Dots on every cell / an empty board.

wipe(horizontal) / wipe(vertical) / fade()

Transitions that clear the board.

for(start, end, step, instructions...)

Repeats the instructions with {i} counting from start to end (for(name, start, end, step, ...) uses {name}); waits FrameDelay after each step; loops can be nested.

wait(seconds)

Pauses the program.

name = sum

A variable, used as {name}. Sums: + - * / % and brackets, sin cos tan sqrt abs log log10 floor ceil round pow min max, pi.

joineduserslist(width, height, x, y, colour, glow, newest first)

Names of players who came, in columns.

stop()

Ends the program and clears the board.

Try: /ledeval background(stars),for(1,100,1,border(solid, TESTING, {r=1,9}, {r=1,9}, true),wait(0.05)),clear() or /ledeval for(1,250,1,ti={ti}+({i} * 0.02) * (1 - {i}/100) + sin({i} * 0.05) * 2,sinewave(5, {i}*6, {ti}+4, X, {r=1,9}, 8,8))

Raw .cs
Loading LEDboard.cs...

Canvases / Grabbables

SprayCan and SprayWall

Grabbable spray paint cans and walls to paint on: two scripts. SprayCan goes on each can (any colour): whoever picks it up gets a Spray button (ListenForGrab, ShowActionButton): on screen on phones, tablets and desktop, the F key on desktop, the right stick click in VR. While it is held down the can hisses (PlayAudioLoop), its spray particles run (SetParticlesPlaying) and it sends the paint to the wall the player aims at (ListenForActionButton with HitUV, PostScriptEvent). SprayWall goes on each wall (a scene can have several): it paints its script canvas where the paint lands: close up a small sharp dot, further back a wider, fainter cloud, too far away and nothing reaches the wall; quick sweeps join into lines; an optional button cleans it. The cans' Grabbable Aim With Camera (on by default) makes the arm point the can where the camera looks, for everybody to see. On the wall, TransparentBackground leaves it see-through so only the paint shows (paint on glass, or over the wall's own texture).

Raw .cs
Loading SprayCan.cs...

SprayWall

Raw .cs
Loading SprayWall.cs...