RBX.lua.Selection (Service)

From Legacy Roblox Wiki
Revision as of 04:06, 10 June 2010 by >GoldenUrg (update with examples from Anaminus)
Jump to navigationJump to search


The Selection object.

This is a Game Service; it cannot be created with Instance.new - it must be obtained using the GetService method, or as a child of game.


Functions

In addition to the global functions, the Selection also has these functions: # indicates a locked function. They can only be used in Studio.

Properties

The Selection object only incorporates the global properties.

Events

The Selection object only incorporates the global events.

Usage

In Studio/Edit mode, first select some bricks then:

local cf = CFrame.Angles( 0,math.pi,0 )
for _,v in pairs(game.Selection:Get()) do 
  v.CFrame = cf * v.CFrame 
end

Also, you can set which objects are selected with the Set method. So then you can do stuff like select all objects with a certain name, then quickly edit their properties as desired.

local select = {} 
for _,v in pairs(workspace:GetChildren()) do 
  if v.Name = "Part" then 
    table.insert(select,v) 
  end 
end 

game.Selection:Set(select)