Destroy or Debris? | Roblox Studio

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ • 16

  • @grovast3167
    @grovast3167 10 місяців тому +6

    Dang didn't realize how useful debris is lol. Definitely will be using for projectiles

    • @geonesfa
      @geonesfa 9 місяців тому

      yes it saves a lot of space in scripts

  • @G4mecomander
    @G4mecomander 10 місяців тому +3

    Debris is :Destroy() but with a timer built in, rarely used tho. Good for emitters and effects.

  • @JessicaCrawford352
    @JessicaCrawford352 10 місяців тому +2

    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.

    • @GuiDuckz
      @GuiDuckz 10 місяців тому +3

      It was prob because of lag. You shouldnt use bricks for effects like that.

  • @Kitsune_Dev
    @Kitsune_Dev 10 місяців тому

    Debris is useful for variables that you are unsure of, you can pass nil into it and it won’t error

  • @tantank
    @tantank 10 місяців тому +2

    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

  • @Avercile172
    @Avercile172 10 місяців тому

    Thanks bro excellent explaining. Definitely a good service to keep in the back of your head for certain situations.

  • @Bubble123
    @Bubble123 10 місяців тому +1

    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.

    • @a_username_lol
      @a_username_lol 9 місяців тому

      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

  • @GuiDuckz
    @GuiDuckz 10 місяців тому +1

    Isnt debris more optimized aswell?

  • @Jackinbox19001
    @Jackinbox19001 10 місяців тому +1

    you very UNDERRATED

  • @KuruptR
    @KuruptR 10 місяців тому

    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.

    • @CyanNStuff
      @CyanNStuff 8 місяців тому

      then just dont destroy it, move it from workspace to serverstorage. also you can't access serverstorage or serverscriptservice from a local script

    • @KuruptR
      @KuruptR 8 місяців тому +1

      @@CyanNStuff This was a month ago, Im way past this now. Thanks anyways.