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 an erupting volcano?

Ok, so I just started Lua last week and have been working hard. I want to slowly teach myself some basics with help from the Wiki and Youtube videos. I have tried to make lots of bricks come out of one place but they wont go away. I tried to make them go away but I can't.

Here is my code:

local f = game.ServerStorage.Fire

bool = true

while bool do
	local fCopy = f:Clone()
	fCopy.Parent = game.Workspace
	wait(0)
end

wait(1)
f:Destroy()

Btw the fire from the volcano is in the Server Storage

2 answers

✓ Accepted answer

You could add the objects to Debris so it doesn't yield.

local f = game.ServerStorage.Fire
firing = true

while firing do
    local fCopy = f:Clone()
    fCopy.Parent = game.Workspace
    game:GetService('Debris'):AddItem(fCopy, math.random(1, 10))
end

What this does is destroy the object within one and ten seconds. You could replace this with a static number, if you choose:

game:GetService('Debris'):AddItem(fCopy, 5)

You may want to find a more efficient way to do this, though; as thehybrid576 said, no other code after the while loop will run in the script until you break the loop.

Hope this helped.

local serverstorage = game:GetService("ServerStorage")
local f =serverstorage.Fire

bool = true

while bool do
    local fCopy = f:Clone()
    fCopy.Parent = game.Workspace
    wait(1)
    fCopy:Destroy() --You are destroying fCopy, since it is the object in the Workspace, also this has to be inside the while true do loop because no other script after this can run until you break the loop
end



1 comment

0

This does not quite work... Now with that wait, I am having to wait for the block to clone.

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