# Can you duplicate objects using dat-gui

**URL:** <https://discourse.threejs.org/t/can-you-duplicate-objects-using-dat-gui/23018>\
**Category:** Questions\
**Tags:** datgui\
**Created:** [February 1, 2021, 1:20am UTC](https://discourse.threejs.org/t/can-you-duplicate-objects-using-dat-gui/23018 "2021-02-01T01:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe\_cancer](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/joe_cancer/32/15934_2.png) [@joe\_cancer](https://discourse.threejs.org/u/joe_cancer)\
**Post date:** [February 1, 2021, 1:20am UTC](https://discourse.threejs.org/t/can-you-duplicate-objects-using-dat-gui/23018/1 "2021-02-01T01:20:04Z")

</div>

I’m trying to make it so that when a user presses a button, it duplicate an existing object in the scene. What I’m trying to do is similar to this [Introduction to Three.js](http://fhtr.org/BasicsOfThreeJS/#44) but the code is old and three.js doesn’t support it anymore. My code is down below:  
[l.html](https://discourse.threejs.org/uploads/short-url/rOWcd91SZ5Tis0tKTjRW4tF22th.html) (4.4 KB)  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 1, 2021, 9:43am UTC](https://discourse.threejs.org/t/can-you-duplicate-objects-using-dat-gui/23018/2 "2021-02-01T09:43:33Z")

</div>

Try it like so: [https://jsfiddle.net/65ayefjm/](https://jsfiddle.net/65ayefjm/)

The example uses the latest version of `three.js` and `dat.gui`. Notice that the material is only cloned so the cloned mesh can receive a new color.

---

<div class="post-metadata">

**Author:** ![joe\_cancer](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/joe_cancer/32/15934_2.png) [@joe\_cancer](https://discourse.threejs.org/u/joe_cancer)\
**Post date:** [February 1, 2021, 2:50pm UTC](https://discourse.threejs.org/t/can-you-duplicate-objects-using-dat-gui/23018/3 "2021-02-01T14:50:18Z")

</div>

Thanks! I was also wondering if you could duplicate groups of objects and edit the size and shape of the all of the duplicates at the same time.
