You can right click an object in explorer and click “Add path to console” to automatically append that object’s path (starting at game) to the end of whatever’s already in console (or at the latest pointer position if that information is available).
I got this idea while working with welds and changing their Part0, Part1, C0, and C1 properties. The only way to edit Object or CFrame properties as of now is through console. It forces us to write out the path of the object, which can get quite annoying after a while.
Good idea, but I think I’d rather have it so that you can drag-and-drop objects into the Object property (similar to Unity).
Another solution would be to make a plugin command line. Add a button to append the current selection into the custom command line using Selection:Get() and object:GetFullName().
I just get objects directly from the Selection service. I have a plugin that loads various commands into the command bar environment. Here’s the relevant portion of it:
local lib = {}
--[==[ Selection
Get nth selection:
s[n]
Insert object as nth selection:
s[n] = object
Remove nth selection:
s[n] = nil
Call function with each selection:
s(function(v,i) print(v,i) -- object, index end)
Alternative:
s[[print(v,i) -- object, index]]
Get selection table:
s()
Set selection table:
s{object, ...}
]==]
lib.s = setmetatable({},{
__index = function(t,k)
return Game:GetService('Selection'):Get()[k]
end;
__newindex = function(t,k,v)
local Selection = Game:GetService('Selection')
local sel = Selection:Get()
if v == nil then
table.remove(sel,k)
else
table.insert(sel,k,v)
end
Selection:Set(sel)
end;
__call = function(t,f)
if type(f) == 'function' then
for i,v in pairs(Game:GetService('Selection'):Get()) do
f(v,i)
end
elseif type(f) == 'string' then
local func,o = loadstring([[return function(v,i) ]]..f..[[ end]])
if func then
func = func()
for i,v in pairs(Game:GetService('Selection'):Get()) do
func(v,i)
end
else
print(o)
end
elseif type(f) == 'table' then
Game:GetService('Selection'):Set(f)
elseif type(f) == 'nil' then
return Game:GetService('Selection'):Get()
end
end;
})
-- load commands into current environment
function _G.c()
local env = getfenv(2)
for k,v in pairs(lib) do
env[k] = v
end
end
Whenever you open a place, you have to call _G.c() to load in the commands, but only once. After that, the s variable can be used to do various things with selections, as described in the script.