Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _G.AngleSelection(selection, rotation, a_rotation)
- local parts = {}
- local origins = {}
- local function FillSelectedParts(parent)
- for i,v in pairs(parent) do
- if #v:GetChildren() > 0 then
- FillSelectedParts(v:GetChildren())
- wait()
- end
- if v:IsA("BasePart") then
- table.insert(parts, v)
- end
- end
- end
- FillSelectedParts(selection)
- -- Gathered all the origins
- local main = parts[1]
- local frame = (rotation ~= nil and CFrame.new(main.Position) * CFrame.Angles(rotation.x, rotation.y, rotation.z) or main.CFrame * CFrame.Angles(a_rotation.x, a_rotation.y, a_rotation.z))
- for i,v in pairs(parts) do
- origins[v] = main.CFrame:toObjectSpace(v.CFrame)
- end
- --- --- --- --- ---
- -- Adjust them via main part
- for i,v in pairs(origins) do
- i.CFrame = frame:toWorldSpace(v)
- end
- end
- for i = 1, 90 do
- _G.AngleSelection(script.Parent:GetChildren(), nil, Vector3.new(0,0,math.rad(i)) )
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement