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

Making a droppers brick disappear after 10 seconds??? For tycoon

This is the code, can you make it vanish after 10 seconds?

function fire()
	local p = Instance.new("Part")
	p.Position = script.Parent.Position
	p.Size = Vector3.new(1,1,1)
	p.BrickColor = BrickColor.new(106) 
	p.BottomSurface = 0
	p.TopSurface = 0
	p.Name = "TycoonBrick" 
	p.Parent = script.Parent
end 


while true do
	wait(2.5) --Alter Rate Of Drop
	fire()
end

1 comment

0

Please insert your code into a code block.

1 answer

✓ Accepted answer

You can make it automatically disappear after 10 seconds using the Debris Service:

local deb = game:GetService("Debris")

function fire()
    local p = Instance.new("Part")
    p.Position = script.Parent.Position
    p.Size = Vector3.new(1,1,1)
    p.BrickColor = BrickColor.new(106) 
    p.BottomSurface = 0
    p.TopSurface = 0
    p.Name = "TycoonBrick" 
    p.Parent = script.Parent
    deb:AddItem(p, 10) -- This is the only change necessary.
end 


while true do
    wait(2.5) --Alter Rate Of Drop
    fire()
end

If the Part it already gone (Destroyed or otherwise) when Debris is told to remove it, very simply nothing happens.

1 comment

0

Thank you so much!

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