Kill Bricks, Lava & Damage Parts
One tag-based script for every hazard: instant-kill lava and damage-over-time parts with cooldowns.
⚑ 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.
--[[
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 ↗Coin Shop (Exploit-Safe)
A server-checked shop: prices live on the server, coins are verified, tools are given safely. Includes the shop window.
Pet That Follows You
Every player gets a floating pet that follows smoothly using AlignPosition, with a gentle bob.
Smooth Doors with Keys
Press E to open doors that swing or slide with a tween, close automatically, and can require a key tool.
Sprint + Stamina Bar
Shift / mobile button / controller sprint with stamina drain, regen delay and a clean stamina bar.