One problem that I have with :Debris() is that there is a limit (from my experience.) because for some reason when I made a "rain" function that just spawned a bunch of parts around the map and added it to debris, but some of the bricks (yes it was raining bricks) would just disappear as soon as they spawned.
Uhm, ackshually, if you don't want to "yield the script", use task.spawn and/or task.delay. If i wanted to destroy something and not "yield the script" I would use that, there is no other point you gave that made me want to use Debris instead. task.delay(5, instance.Destroy, instance) You can even make the process faster by defining delay as task.delay.
task.spawn would be WAY laggier than using debris actually delay would be too since it also creates a new thread unlike debris so its better in every way
What about making a model disappear moving a part from workspace to ServerStorage back to workspace, it runs my code the first time but not when returning from ServerStorage. It seems to run a LocalScript but not a regular script. I tried using Debris but I dont know if its possible to retrieve the part after destroying it with Debris.
Dang didn't realize how useful debris is lol. Definitely will be using for projectiles
yes it saves a lot of space in scripts
Debris is :Destroy() but with a timer built in, rarely used tho. Good for emitters and effects.
One problem that I have with :Debris() is that there is a limit (from my experience.) because for some reason when I made a "rain" function that just spawned a bunch of parts around the map and added it to debris, but some of the bricks (yes it was raining bricks) would just disappear as soon as they spawned.
It was prob because of lag. You shouldnt use bricks for effects like that.
Debris is useful for variables that you are unsure of, you can pass nil into it and it won’t error
BRO I had to use both of them in the hitbox function in my combat system module.
Edit: I have no clue what I'm doing
Thanks bro excellent explaining. Definitely a good service to keep in the back of your head for certain situations.
Uhm, ackshually, if you don't want to "yield the script", use task.spawn and/or task.delay. If i wanted to destroy something and not "yield the script" I would use that, there is no other point you gave that made me want to use Debris instead.
task.delay(5, instance.Destroy, instance)
You can even make the process faster by defining delay as task.delay.
task.spawn would be WAY laggier than using debris actually delay would be too since it also creates a new thread unlike debris so its better in every way
Isnt debris more optimized aswell?
In certain scenerios yes
you very UNDERRATED
What about making a model disappear moving a part from workspace to ServerStorage back to workspace, it runs my code the first time but not when returning from ServerStorage. It seems to run a LocalScript but not a regular script. I tried using Debris but I dont know if its possible to retrieve the part after destroying it with Debris.
then just dont destroy it, move it from workspace to serverstorage. also you can't access serverstorage or serverscriptservice from a local script
@@CyanNStuff This was a month ago, Im way past this now. Thanks anyways.