Minecraft lava in Roblox?

How could I make something similar to Minecraft lava in Roblox?

Any help appreciated!

Well, I think there’s a tutorial on animated textures, but im not sure.

As for the scripting, you’ll probably want to check if there’s a player colliding with the lava every second, then damage them by 5, so probably a while loop?

local lava = script.Parent

while task.wait(1) do
	local alreadyHit = {}
	local touchingParts = workspace:GetPartsInPart(lava)
	for i,v in pairs(touchingParts) do
		if v.Parent and not alreadyHit[v.Parent] and v.Parent:FindFirstChild("Humanoid") then
			alreadyHit[v.Parent] = true

If you plan to use multiple instances of this lava, I’d reccommend using CollectionService which i’ll link A Tutorial to what would work for your case.

Now just add your swimming system (if you have one) to the lava, and it should work!

1 Like

No, I meant how the lava spreads when its placed, like in minecraft.

Oh, err, I have no clue how you’d go about that, but I found A useful post giving good examples on how you’d go about it. Someone also sent An example place file that you can use to get started on your system!

1 Like

You could check all 4 sides of the block to see if there’s any other part occupying that space with LookVector and RightVector (And UpVector if you want it to flow downwards too.)
Assuming our block is 4x4x4 studs in dimensions, checking for anything in front would look something like:

if #workspace:GetPartsBoundInBox(Lava.CFrame+Lava.CFrame.LookVector*2,Vector3.new(1,1,1) >= 1 then
--there is an object occupying that space
--create more lava

If you want to create more lava, you might want to decrease the height each time and have it check to see if it’s at a certain height to stop. Otherwise, it might go on forever.

if Lava.Size.Y > 0.5 then
local Clone = Lava:Clone()
Clone.Parent = workspace
Clone.Size -= Vector3.new(0,1,0)
Clone.Position = Direction_Here
1 Like