How do you change the size/properties of water?

I’m trying to make a Floor Is lava game and every game I see has water that goes up and up ( Rising ) . I tried doing this but ran into many errors because I have no clue how to even try that. Does anyone have advice or things I could try? Thank you!

It has a property called appearance, so is tht what u want? Basically I wud say to create another part on too of the lava with lava texture and set its canCollide to false. So when the player falls in u can just check if he collided with the part.

Example:
Tutorial

For the lava rising, u mite have to use tweenservice, for smooth changes.

1 Like

My issue is I don’t know how to make the lava change its height or size. For it to go up.

Replace the part with ur lava part.

local TweenService = game:GetService("TweenService")
 
local part =  game.workspace.Lava
local goal = {}
goal.Size = Vector3.new(part.Position.X, 90, part.Position.Z)
 
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
 
local tween1 = TweenService:Create(part, tweenInfo, goal)

-- listen for their completion status
tween1.Completed:Connect(function(playbackState)
	print("tween1: "..tostring(playbackState))
end)
 
-- try to play them both
tween1:Play()

If u need explanation msg me here.

That’s what I planned on doing but I would like to make it actual water not just a part for realism.

Doesn’t do anything when I try it with the water instead of the part.

Use humanoid.StateChanged to detect the state change and if the newstate is swimming, kill the player.

1 Like

The first question should be are you talking about using Terrain water or a Part?
Terrain water can be scripted by Terrain Editor | Roblox Creator Documentation but the only issue with that is that the water will rise in 1 voxel, or 4 stud layers.

1 Like
--Script inside ServerScriptService
local Terrain = workspace.Terrain 

--lava color
Terrain.WaterColor = Color3.fromRGB(255, 100, 0)

local material = Enum.Material.Water 

--position and start size of lava(position Y is basically the floor under the lava)
local start_pos = CFrame.new(0, 0, 0)
local start_siz = Vector3.new(100, 20, 100)

--the bigger speed is, the faster lava rises
local speed = 10000 
--end height in studs
local end_height = 500

--apply math to convert position center to position floor for Y
start_pos = CFrame.new(start_pos.X, start_pos.Y+start_siz.Y/2, start_pos.Z)
Terrain:FillBlock(start_pos, start_siz, material)
--lava animation
local position = start_pos 
local size = start_siz 
for i = size.Y/2, end_height, 1 do
	size = Vector3.new(size.X, 1, size.Z)
	position = CFrame.new(position.X, position.Y+1, position.Z)
	Terrain:FillBlock(position, size, material)
	task.wait(1/speed)
end

task.wait(10) --where 10 is the round length

--erase lava
local end_pos = CFrame.new(start_pos.X, start_pos.Y+(end_height-start_siz.Y)/2, start_pos.Z)
local end_siz = Vector3.new(start_siz.X, start_siz.Y/2+end_height, start_siz.Z)
Terrain:FillBlock(end_pos, end_siz, Enum.Material.Air)

and to detect lava collisions(assuming the only in-game terrain is lava):

Part.Touched:Connect(function(hit)
	if hit == workspace.Terrain then
		print(Part.Name.." touched lava")
	end
end)
2 Likes

@DoctorDret if you ever plan on adding other terrain apart from the rising lava you can use a raycast and gather terrain material data. The above will work perfect if you just have lava as your only in-game terrain

(Meant to reply to pago)

2 Likes

Correct, there’s also a topic regarding water collisions:

1 Like