BLOXBUILDS
Discord
Back
OBBY

Kill Brick (Lava)

Paste as a Script inside a lava part. COLOR and COOLDOWN are at the top. Touching the part kills the character, then ignores that character until the cooldown ends.

-- Paste as a Script inside a lava part.

local COLOR = Color3.fromRGB(255, 70, 40)
local COOLDOWN = 1

local part = script.Parent
if not part or not part:IsA("BasePart") then
	return
end

part.Color = COLOR
part.Material = Enum.Material.Neon

local lastHit: { [Humanoid]: number } = {}

part.Touched:Connect(function(hit)
	local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
	if not humanoid or humanoid.Health <= 0 then
		return
	end

	local previous = lastHit[humanoid]
	if previous and os.clock() - previous < COOLDOWN then
		return
	end

	lastHit[humanoid] = os.clock()
	humanoid.Health = 0
end)