Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I make a brick that slowly kills? (Please help I've been waiting)

Asked by 9 years ago

I wanted to make a brick so when you are on it, it slowly damages you as long as you are on it. For example, you're head is in a water brick and you are supposed to drown, right? So you slowly lose 5 health until you die as long as your head is underwater. How can I do this? This is my script and it seems to not work.



function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then for i = 1, 2000 do wait(1) h.Health = h.Health - 5 end end end script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
-1
Answered by
duckyo01 120
9 years ago
local debounce = false

script.Parent.Touched:connect(function (hit)
if not debounce then debounce = true
guy = hit.Parent:FindFirstChild("Humanoid")
if guy ~= nil then
--[[Next line is optional, it just makes the person unable to move.
guy.Torso.Anchored = true]]--
guy.Health = guy.Health - 0.003
wait(0.01)

debounce = true
end
end

I believe this would work hopefully

0
This script does not seem to work, I tested it out and it only damages me once and stops. Is there supposed to be something that is missing? laughablehaha 494 — 9y
Ad

Answer this question