Basically, if you call this on an object in Debris before it is removed it should extend the lifetime of that object by whatever you put in the parameters of the second call.
I think it should just set the lifetime to whatever you set it to. It would be weird to have to use negative numbers to subtract.
The point of the Debris service is to ensure that a given object is removed within a certain amount of time even if the script stops running. If you want fine-tuned behavior like this, you are better off creating your own debris system.
wha-la, custom debris:
spawn(function()
wait(TimeToRemove)
Object:Destroy()
end)
[quote] wha-la, custom debris:
spawn(function()
wait(TimeToRemove)
Object:Destroy()
end)
[/quote]
But I can’t extend the time I want it to last after calling that. I just thought extending the lifetime of debris could be a nice feature, if you wanted there to be a certain event that makes debris last longer.
Script in the ServerScriptService
local debris = {}
game.ReplicatedStorage.AddDebris.OnServerInvoke:connect(function(item, lifetime)
debris[item] = debris[item].lifetime and debris[item].lifetime + lifetime or lifetime
end)
lastUpdate = tick()
while game:GetService(“RunService”).Stepped:wait() do
local currentTime = tick()
for item, lifetime in pairs(debris) do
lifetime = lifetime - (currentTime - lastUpdate)
if lifetime <= 0 then
item:Destroy()
end
end
lastUpdate = currentTime
end
local script:
game.ReplicatedStorage.AddDebris:FireServer(workspace.Baseplate, 1)
game.ReplicatedStorage.AddDebris:FireServer(workspace.Baseplate, 1)
game.ReplicatedStorage.AddDebris:FireServer(workspace.Baseplate, 1)
–removes the baseplate 3 seconds later