BetterDebris, Fires event on ItemAdded (Fires Event Before Instance Destroyed)

:link: Get The Module

IDK, if this should be an official feature or not but I’ve added 2 things to Debris that could be useful for some cases.

  1. BetterDebris:WatchItem(Instance): (Connect, Once, Wait) -> Tuple[LifeTime, CreatedAt]
    This just makes you able to Connect to an AddItem event of BetterDebris.
  1. BetterDebris:IsItemAdded(Instance): Tuple[LifeTime, CreatedAt]
    This lets you able to check if an Instance is going to be deleted or not.

SSoQTMYCA (Some Sort of Questions That Maybe You Can Ask):

Where on the earth will this be useful for me?

  • It’s up to your imagination, but maybe it would be useful if you want a fade-out animation on GUI elements before it’s destroyed.

Can I watch descendant Instances of Instances that were added on Debris?

  • Yes, of course.

Can I use this with multiple scripts even one server and one client?

  • Yes, there is an example of something like that below.

Is this optimized?

  • As, good enough…

Are you sure that if you test it correctly?

  • Maybe, IDK…

Usage Example:

-- Server
local BetterDebris = require(game.ReplicatedStorage.BetterDebris)
game.Players.PlayerAdded:Once(function()
	task.wait(5)
	BetterDebris:AddItem(workspace.Part, 5)
end)
-- Client
local BetterDebris = require(game.ReplicatedStorage.BetterDebris)

BetterDebris:WatchItem(workspace:WaitForChild("Part")):Once(function(LifeTime, CreatedAt)
	print("Part will be destroyed", LifeTime)
end)
Do you think if this would be useful?
  • Nah, this is just like all other new-gen trash addons that pop out from nowhere every day
  • LMAO, you’r trying to make a module. So cute XDDD
  • Look’s interesting, but still useless.
  • Maybe… IDK
  • Yes
  • Yes, and something like this should be added as a Core feature of the Debris service!

0 voters

Dear DevForum Staff

Please do not remove my Topic, I just want to be it not boring as hell. Options are just jokes.

Also, reply to this topic with your thoughts to support this <3

2 Likes