Make a clone part system

I want to make a clone system when you duplicate the part by touch event. I know how to make those script but the problem is I can’t make it by deleting itself. I want to make a duplication part system when you touched, the trigger will activate so it will duplicate the part which means it spawned a new part and I want the previous part that was already spawned due to the player have been touched the trigger event twice will delete the previous. let’s just say you spawned a new part. And I want to spawn it again but this time I want the previous part that already spawned by the player which means me as a player will delete the previous part that already spawned seconds ago or minutes ago. Which means the new part spawned, the old part was deleted. If anyone know how to make this function, please let me know. I’ve been struggling making this for so long

hmmm so, like this?

local part = nil
   if part then
   local part = script.Parent:Clone()
   part.Parent = workspace
1 Like

Hello there!
I’m still trying to understand your problem… You’re saying you want a clone system on a part, and when you touch this part you create a clone of it, correct? But then, I don’t understand why you wouldn’t be able to just delete the part you touched.
Because I’m looking at the solution rtvr just gave and it’s along the lines of what I was thinking.
Can you develop a bit more on these?

I’ll let you know if it works. I’m gonna try this

It doesn’t work tho. I tried many times. Thanks for the help

Honestly, I think you need to explain your problem better, since i didn’t understand what you said to be honest

Basically I want to copy the new part and the old part will be deleted at the same time. So which means when you duplicate the new part, old part will be deleted and I want to make it works with the script

So your trying to say when you touch the part another one will get created at the same position, name, color etc and the old one will be deleted?

Yes, you got it right. That is what I’m trying to create with the script

Does anyone have any solutions? It’s been a while now