Does anyone know how you can make a block that slowly kills you after being touched?
✓ ANSWER ACCEPTED
How to make a block that slowly kills you after touching it?
2 answers
✓ Accepted answer
Put this under the part that will kill
local killPart = script.Parent
local damage = 10 -- change this to how much damage to do
local debounce = true
killPart.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
debounce = false
local hum = part.Parent:FindFirstChild("Humanoid")
hum:TakeDamage(damage)
repeat wait()
killPart.TouchEnded:Connect(function()
debounce = true
end)
until debounce
end
end)
You could make use of the Touched event and then slowly damage the player after he hits it.
Eg :
local globalDeb = false
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') and not globalDeb then
globalDeb = true
repeat wait(0.8) hit.Parent.Humanoid:TakeDamage(10) until hit.Parent.Humanoid.Health <= 0
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thank you! This helped me a lot.
np