Is there any way to fix this so that the dropper keeps dropping every 2 seconds, but blocks that are left on the ground for 10 seconds get deleted?
function drop() Block = Instance.new('Part', workspace) Block.Position = script.Parent.DropPart.Position + Vector3.new (0,-2,0) Block.Name = 'ThingWorf' local worth = Instance.new('NumberValue', Block) worth.Name = "Worth" worth.Value = 5 Block.Size = Vector3.new(1,1,1) wait(10) Block:Destroy() end while true do drop() wait(2) end
You can use Debris
service for this purpose.
function drop() Block = Instance.new('Part', workspace) Block.Position = script.Parent.DropPart.Position + Vector3.new (0,-2,0) Block.Name = 'ThingWorf' local worth = Instance.new('NumberValue', Block) worth.Name = "Worth" worth.Value = 5 Block.Size = Vector3.new(1,1,1) game:GetService("Debris"):AddItem(Block, 10) end while wait(2) do drop() end