The SScene class represents the region the user is currently in.
Finds a single Game Object matching 'Name' and returns it. Can use '/' characters to designate a path (e.g. 'Parent/Child' returns Child with 'Parent')
hand = Space.Scene.Find("Hand"); --This returns the GameObject named Hand. hand = Space.Scene.Find("/Hand"); --This returns the GameObject named Hand. --Hand must not have a parent in the Hierarchy view. hand = Space.Scene.Find("/Monster/Arm/Hand"); --This returns the GameObject named Hand, --which is a child of Arm > Monster. --Monster must not have a parent in the Hierarchy view. hand = Space.Scene.Find("Monster/Arm/Hand"); --This returns the GameObject named Hand, --which is a child of Arm > Monster.
Finds a single Game Object using ID and returns it
local obj=Space.Scene.FindID("123")
Space.Log(obj.Name);
mat.SetColor("_Color",Color.New(0,0,1,1))
Get reference to avatar using ID
Get reference to avatar using Username
Marks the Game Object as temporary. Temporary objects will be cleaned up automatically if the script is destroyed or reset. Can be used to handle cleanup from procedural objects created by a script.
An event which is fired when play exists Room Edit mode
Space.Log("End Edit Mode")
An event which is fired when player enters Room Edit mode
Space.Log("Enter Edit Mode")
Creates a new empty game object with the name 'Name' and returns a reference
newObject = Space.Scene.CreateGameObject("potato")
Creates a game object from the specified resource
res = Space.GetResource("Tomato") --declare it as resource in your Scripting Runtime component Space.Scene.CreateGameObject(res)
Event which fires whenever a player joins the region
Event which fires whenever a player joins the region
--Place this script in a UIText object and it will --update itself with the name of the last player joined function updateText(Av) --we include "Av" here because the event gives us a reference to the Avatar that joined Space.Host.ExecutingObject.UIText.Text= "Last player joined: " .. Av.Username end Space.Scene.OnPlayerJoin(updateText) -- updateText will now be called everytime a player joins
Event which fires whenever a player leaves the region
function playerLeft(id) -- end Space.Scene.OnPlayerLeave(playerLeft)
--Place this script in a UIText object and it will --update itself with the name of the last player left function updateText(Av) --we include "Av" here because the event gives us a reference to the Avatar that has left Space.Host.ExecutingObject.UIText.Text= "Last player left: " .. Av.Username end Space.Scene.OnPlayerLeave(updateText) -- updateText will now be called every time a player leaves
Event which fires whenever a player leaves the region
Return an avatar with id.
Return an avatar with id.
Returns the current player avatar. If this script is calling this upon initialisation, the Player may not exist yet, and you will want to wait a few frames until the avatar is present before continuing.
CurrentPlayer = Space.Scene.PlayerAvatar
Returns a list of Avatars in the scene
avatars = Space.Scene.Avatars
Returns a list of Objects in the scene. IMPORTANT: This function is slow, you should cache the result and avoid calling this every frame.
objects = Space.Scene.Objects
Returns the name of the current region
RegionName = Space.Scene.Name
Returns the URL of the current region
RegionUrl = Space.Scene.Url
Returns the avatar ID of the regions owner
RegionOwner = Space.Scene.Owner
Return all avatars in the scene.
Space.Log(#avatars)
Returns the region ID of current region.
Return the instance ID of current region.
Switch to a shard region.
Return true if current player is the region admin.
--this script will make the object a clickable, but only if player is region Admin --(Example: Access control) thisGameObject = Space.Host.ExecutingObject OnClick = function() Space.Log("this click was only possible because you are a region Admin") end if Space.Scene.PlayerIsAdmin then thisGameObject.AddClickable() thisGameObject.Clickable.Tooltip = "Click me Admin" thisGameObject.Clickable.OnClick(OnClick) end
Return true if current player is Moderator.
--this script will make the object a clickable, but only if player is Moderator in this region --(Example: Access control) thisGameObject = Space.Host.ExecutingObject OnClick = function() Space.Log('this click was only possible because you are Moderator in this region') end if Space.Scene.PlayerIsModerator then thisGameObject.AddClickable() thisGameObject.Clickable.Tooltip = "Click me Moderator" thisGameObject.Clickable.OnClick(OnClick) end
Returns whether the current player is the owner of the region
isOwner = Space.Scene.PlayerIsOwner
--this script will make the object a clickable, but only if player is region owner --(Example: Access control) thisGameObject = Space.Host.ExecutingObject OnClick = function() Space.Log("this click was only possible because you are a region Owner") end if Space.Scene.PlayerIsOwner then thisGameObject.AddClickable() thisGameObject.Clickable.Tooltip = "Click me" thisGameObject.Clickable.OnClick(OnClick) end
Returns whether the current player is the owner of the region
isOwner = Space.Scene.PlayerIsOwner
--this script will make the object a clickable, but only if player is Trusted in this region --(Example: Access control) thisGameObject = Space.Host.ExecutingObject OnClick = function() Space.Log("this click was only possible because you are Trusted in this region") end if Space.Scene.PlayerIsTrusted then thisGameObject.AddClickable() thisGameObject.Clickable.Tooltip = "Click me Trusted" thisGameObject.Clickable.OnClick(OnClick) end
Returns true if current player is in edit mode.
Return an array of all floors in the region.
Space.Log(Space.Scene.Floors[i].Name)
end
|