RBX.lua.Selection (Service): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker mNo edit summary |
>GoldenUrg update with examples from Anaminus |
||
Line 1: | Line 1: | ||
{{CatUp|Class reference}} | {{CatUp|Class reference}} | ||
__NOTOC__ | __NOTOC__ | ||
Line 9: | Line 8: | ||
==Functions== | ==Functions== | ||
In addition to the global functions, the Selection also has these functions: | In addition to the global functions, the Selection also has these functions: | ||
''<font color="red"># indicates a locked function. | ''<font color="red"># indicates a locked function. They can only be used in [[Studio]].</font>'' | ||
*<font color="red">#</font>[[Get (Function)|Get()]] | *<font color="red">#</font>[[Get (Function)|Get()]] | ||
Line 20: | Line 19: | ||
The Selection object only incorporates the global events. | The Selection object only incorporates the global events. | ||
==Usage== | |||
In Studio/Edit mode, first select some bricks then: | |||
<pre> | |||
local cf = CFrame.Angles( 0,math.pi,0 ) | |||
for _,v in pairs(game.Selection:Get()) do | |||
v.CFrame = cf * v.CFrame | |||
end | |||
</pre> | |||
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. | |||
<pre> | |||
local select = {} | |||
for _,v in pairs(workspace:GetChildren()) do | |||
if v.Name = "Part" then | |||
table.insert(select,v) | |||
end | |||
end | |||
game.Selection:Set(select) | |||
</pre> | |||
[[Category:ROBLOX Lua Services]] | [[Category:ROBLOX Lua Services]] | ||
[[Category:Stubs]] | [[Category:Stubs]] |
Revision as of 04:06, 10 June 2010
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)