true
null
nil
-
ElementReorderPlugin
-1
-
false
Script
0
{03B267F1-30E1-4ED2-B58E-1AB8A6A5F6C6}
= {[K]: V}
local reparentedElements: Map = {}
local testFolder = Instance.new("Folder")
testFolder.Parent = game.ServerScriptService
moveElementAsLast.Click:Connect(function()
local selectedElements = Selection:Get() --We obtain selected items and then iterate through them
for i,v in pairs(selectedElements) do
--This is a really hacky method pushing selection to be the last in the children list.
--We take out that element from parent and then re-parent it back to it appears as the last children.
--This also means this can be utilized not just on UI's, but pretty much everywhere.
reparentedElements[v] = v.Parent
local originalParent = v.Parent
v.Parent = game.ServerScriptService --Why ServerScriptService: Apparently this magically minimizes losses of children, don't ask me how does that work, it just does. I found it out by trial and error.
v.Parent = originalParent
end
Selection:Set(selectedElements) --just incase some of the selection was lost, recover it.
end)
retrieveElements.Click:Connect(function()
for instance,parent in pairs(reparentedElements) do
if instance.Parent == nil then
instance.Parent = parent
end
reparentedElements[instance] = nil
end
end)]]>
-1