func (root *Root) Copy() *Root {
	clone := &Root{
		Instances: make([]*Instance, len(root.Instances)),
	}
	refs := make(References)
	crefs := make(References)
	propRefs := make([]PropRef, 0, 8)
	for i, inst := range root.Instances {
		clone.Instances[i] = inst.clone(refs, crefs, &propRefs)
	}
	for _, propRef := range propRefs {
		if !crefs.Resolve(propRef) {
			refs.Resolve(propRef)
		}
	}
	return clone
}
Copy creates a copy of the root and its contents.

A copied reference within the tree is resolved so that it points to the
corresponding copy of the original referent. Copied references that point
to an instance which isn't being copied will still point to the same
instance.
package rbxfile
import (
	"errors"
)
type Root struct {
	Instances []*Instance
	Metadata map[string]string
}
func NewRoot() *Root {
	return &Root{
		Instances: []*Instance{},
		Metadata:  map[string]string{},
	}
}