CUBE BURSTSTUDIOS
hazard-bricks.zip
Details

Kill Bricks, Lava & Damage Parts

One tag-based script for every hazard: instant-kill lava and damage-over-time parts with cooldowns.

Category
Code
File
hazard-bricks.zip
Size
1.5 KB
Downloads
0
Added
16 Oct 2026
Licence
Free to use, no credit needed (CC0)

#kill brick#lava#damage#obby#hazards#luau#roblox#script

⚑ Report this

One tag-based script for every hazard: instant-kill lava and damage-over-time parts with cooldowns.

One script for every hazard in your game, using tags instead of a script inside each part.

SETUP
1. Put this Script in ServerScriptService.
2. Tag parts (Properties > Tags):
"KillBrick" -> instant death (lava, void, spikes)
"DamageBrick" -> hurts while touching. Set a number attribute "Damage" (default 10) and optional
"Cooldown" in seconds (default 0.5).
3. That's it: parts added later (new maps, clones) work automatically.

The main script is shown below with a Copy button, or grab the download with every file and a README.

HazardBricks.server.lua
--[[
	Kill Bricks, Lava & Damage Parts  ·  by Cube Burst Studios  ·  CC0
	One script for every hazard in your game, using tags instead of a script inside each part.

	SETUP
	1. Put this Script in ServerScriptService.
	2. Tag parts (Properties > Tags):
	   "KillBrick"   -> instant death (lava, void, spikes)
	   "DamageBrick" -> hurts while touching. Set a number attribute "Damage" (default 10) and optional
	                   "Cooldown" in seconds (default 0.5).
	3. That's it: parts added later (new maps, clones) work automatically.
]]

local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")

local lastHit = {} -- [part][humanoid] = os.clock() of last damage

local function humanoidFrom(hit)
	local model = hit:FindFirstAncestorOfClass("Model")
	local humanoid = model and model:FindFirstChildOfClass("Humanoid")
	if humanoid and humanoid.Health > 0 and Players:GetPlayerFromCharacter(model) then
		return humanoid
	end
	return nil
end

local function setupKill(part)
	part.Touched:Connect(function(hit)
		local humanoid = humanoidFrom(hit)
		if humanoid then
			humanoid.Health = 0
		end
	end)
end

local function setupDamage(part)
	lastHit[part] = {}
	part.Touched:Connect(function(hit)
		local humanoid = humanoidFrom(hit)
		if not humanoid then
			return
		end
		local now = os.clock()
		local cooldown = part:GetAttribute("Cooldown") or 0.5
		local hits = lastHit[part]
		if hits and (not hits[humanoid] or now - hits[humanoid] >= cooldown) then
			hits[humanoid] = now
			humanoid:TakeDamage(part:GetAttribute("Damage") or 10) -- TakeDamage respects ForceFields
		end
	end)
	part.Destroying:Connect(function()
		lastHit[part] = nil
	end)
end

local function watch(tag, setup)
	for _, part in ipairs(CollectionService:GetTagged(tag)) do
		if part:IsA("BasePart") then
			setup(part)
		end
	end
	CollectionService:GetInstanceAddedSignal(tag):Connect(function(part)
		if part:IsA("BasePart") then
			setup(part)
		end
	end)
end

watch("KillBrick", setupKill)
watch("DamageBrick", setupDamage)

MORE
CODE

View all ↗