How do I cancel a destroy function once I click on a part

Could you not just spawn the parts into the workspace folder as you are doing and add them to the Debris system for automatic removal. If the player clicks on the part, destroy it, then just spawn a new instance of the same part into their backpack and don’t add it to the Debris system.

The issue is that debris has no function to remove an item once you add an item into it, so I’m using the destroy function to make it easier

This is the documentation for Debris Service

That is the solution I am trying to suggest. Allow the clickable workspace version of the part to be destroyed either when clicked-on or after the allotted time. Just create a new version of the part inside the players backpack with no logic attached to automatically destroy it.

Try this:

futureGuy13_TestPlace.rbxl (55.5 KB)

EDIT: I kept tinkering but nothing changed fundamentally, just some tidying up and commenting

Okay yeah I think that actually might work and I can finally close this post, I just kinda have to just clone the part into the backpack and it should be fine

Okay cool, I’m glad I was able to help you in any small way. The CollectionService part might not be to your liking. I always tend to use it for the creation of instances with “Collective” behaviour. You could easily remove the collection stuff here and just add the logic from addPart() into the createPart() function. I’m not sure how you intend to manipulate the parts being spawned, so I used the service to allow you to expand on the parts behaviour in the future, without any additional work by yourself. You can pretty much do anything you want with stuff once they have been tagged for collection.

Close the post by marking a solution, it keeps the forum up-to-date. And can possibly provide a solution to others seeking the same.

1 Like

okay, its closed now. thanks everyone for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.