Hello everyone! I am making a game which uses a building mechanic, and I wanted a bucket of lava that players could equip and use maybe in moats. So how would I go about building that? I already have a data saving and equipping system, so I just need to know how to make a bucket of lava. It should spread when you place it. Thanks!
I can’t make an exact code, but I can tell you what I would do. I would make it so it starts by making a block of lava – you can make the block of lava with a lava texture. Then, make it so the lava then copies more lava. You can make different shapes of lava.
Oh, okay… but how would it know where to put the lava? The first block would go in the space where you clicked, but then?
I would say make the next lava flow in a random position would go in a random position touching the lava and continue flowing that way
Ok, I’ll try that! Thanks very much!
Here is my script:
local number = 1
function spread()
local lava = game.Workspace:FindFirstChild("LavaBlock"..number)
local position = lava.Position
local newpos = position + Vector3.new(4,0,0)
local clone = lava:Clone()
clone.Size = lava.Size - Vector3.new(0,.5,0)
clone.Parent = workspace
clone.Position = newpos
local newnum = number + 1
number = newnum
clone.Name = "LavaBlock"..number
end
while true do
wait(1)
spread()
end
That looks great! Just make sure the lava is always touching the other piece of lava. A good example is how actual Minecraft lava works. It flows depending on it’s position, which way it’s facing, and other factors.
There is something wrong with the script though… It updates the number from 1 to 1 to 2 to 4 to 3 to 1 to 5… so the script gets glitchy and spawns blocks in each other, making the game lag. Any idea how I would fix that? Thanks!
you can check if the position next to it is already taken, and with some math, check how high the level of lava is, if it isn’t max, add height to the part
Okay, I will try that! Thanks!
Liquids in minecraft work in a far more different way, so cloning full liquid block would cause an infinite spam of the liquid.
I tried making it using the grid system, though it didn’t work out very well.
Lava.rbxl (26.9 KB)
Here’s the .rblx file if you wanna check it out.
This is a very detailed reply, thanks very much!
Your lava system is amazing! I love it! Thanks!