Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local changed = false
- function lockItems(items)
- changed = false
- if items ~= nil then
- for _,v in pairs(items) do
- if v ~= nil then
- if v:IsA("BasePart") then
- if v.Locked == false then
- v.Locked = true;
- changed = true
- end
- else
- lockItems(v:GetChildren())
- end
- end
- end
- if not changed then
- for _,v in pairs(items) do
- if v:IsA("BasePart") then
- v.Locked = false;
- end
- end
- end
- end
- changed = false
- end
- function anchorItems(items)
- changed = false
- if items ~= nil then
- for _,v in pairs(items) do
- if v ~= nil then
- if v:IsA("BasePart") then
- if v.Anchored == false then
- v.Anchored = true;
- changed = true
- end
- else
- anchorItems(v:GetChildren())
- end
- end
- end
- if not changed then
- for _,v in pairs(items) do
- if v:IsA("BasePart") then
- v.Anchored = false;
- end
- end
- end
- end
- changed = false
- end
- local toolbar = PluginManager():CreatePlugin():CreateToolbar("Toolbar")
- toolbar:CreateButton("", "Lock (or unlock) everything selected.", "Lock.png").Click:connect(function()
- lockItems(game.Selection:Get())
- end)
- toolbar:CreateButton("", "Anchor (or unanchor) everything selected.", "Anchor.png").Click:connect(function()
- anchorItems(game.Selection:Get())
- end)
- print("Loaded Locker")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement