Skinstashery
Roblox
Home / Roblox / Studio script library / Rising lava
RB-004

Roblox rising lava script

Lava that slowly climbs, kills on touch, then drops back down to start again.

Script type
Script
Where it goes
Inside the lava Part
Category
Hazards and pads

For your own game in Roblox Studio. Not for use in other people's games.

The code

-- Rising lava: the part climbs, kills on touch, then resets and repeats.

local START_DELAY = 10       -- seconds before the lava starts to rise
local RISE_HEIGHT = 60       -- studs to rise
local RISE_TIME = 90         -- seconds to rise that far
local PAUSE_AT_TOP = 5       -- seconds to wait at the top
local RESET_DELAY = 5        -- seconds to wait after dropping back down

local TweenService = game:GetService("TweenService")

local lava = script.Parent
lava.Anchored = true

local startPosition = lava.Position
local endPosition = startPosition + Vector3.new(0, RISE_HEIGHT, 0)

-- Kill anything with a Humanoid that touches the lava.
lava.Touched:Connect(function(hit)
	local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
	if humanoid and humanoid.Health > 0 then
		humanoid.Health = 0
	end
end)

local riseTween = TweenService:Create(
	lava,
	TweenInfo.new(RISE_TIME, Enum.EasingStyle.Linear),
	{ Position = endPosition }
)

while true do
	lava.Position = startPosition
	task.wait(START_DELAY)

	riseTween:Play()
	riseTween.Completed:Wait()

	task.wait(PAUSE_AT_TOP)
	lava.Position = startPosition
	task.wait(RESET_DELAY)
end

How to set it up

  1. Insert a large flat Part below your map. Colour it orange and set the Material to Neon.
  2. Put your map so the lava can rise past it.
  3. Add a Script inside the lava Part and paste the code.
  4. Play. After 10 seconds the lava starts to rise.

Change it

More in Hazards and pads

All Roblox scripts

More Roblox tools