|
| 24 Aug 2013 02:57 PM |
| Something that will drain your health if it touches your head as you continue to touch it |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2013 03:02 PM |
local water = script.Parent
function onTouch(part) local hum = part.Parent:findFirstChild("Humanoid") if (hum~=nil) then touched = true local char = hum.Parent if part = char.Head then while true do if touched = true then hum.Health = hum.Health - 1 end end end end end
water.Touched:connect(onTouch) water.TouchEnded:connect(function(otherPart) touched = false end) |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2013 03:07 PM |
^doesn't work, too many unspecified values
what's water? whats otherPart? |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2013 03:09 PM |
>local water = script.Parent
put the script inside the water |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 24 Aug 2013 03:09 PM |
Lol, otherPart's the name of a one-line function that he created in the same line as the connection to it
'water' is the water part in question, he's just tagging it as that assuming the script is inside the water brick |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2013 03:19 PM |
Once I leave the water, my client crashes.... I had the same time with touching it, but I solved it by adding a wait... |
|
|
| Report Abuse |
|
|
| |
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 24 Aug 2013 03:53 PM |
water = script.Parent db = false
water.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") and not db then db = true repeat wait(.5) hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -1 until hit.Parent.Humanoid.Health <= 0 db = false end end)
--This might not work
|
|
|
| Report Abuse |
|
|
| |
|