Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a tycoon part disappear?

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

1 answer

✓ Accepted answer

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

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.