ozza
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 726 |
|
|
| 04 May 2012 09:37 PM |
So, I was wondering how to stop doing damage after they aren't touching the lava.
hit = false db = false
script.Parent.Touched:connect(function(hit) g = hit.Parent:findFirstChild("Humanoid") if db == false and g then hit = true for i = 1,10 do g:TakeDamage(1) wait() end end end)
|
|
|
| Report Abuse |
|
|
mage11561
|
  |
| Joined: 03 Sep 2008 |
| Total Posts: 13217 |
|
|
| 04 May 2012 09:41 PM |
| You could check the magnitude, and if it exceeds a certain parameter, it'll assume you're not touching anymore. |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 04 May 2012 09:52 PM |
Or use the .TouchEnded event...
With a Five-Guys burger in my hands, I am now invincible! |
|
|
| Report Abuse |
|
|
|
| 04 May 2012 09:53 PM |
Idk, I guess this will work:
local t = false
script.Parent.Touched:connect(function(item) if (t) then return end local player = game.Players:GetPlayerFromCharacter(item.Parent) if (not player) then return end t = true while (t) do wait(0.1) player.Character.Humanoid:TakeDamage(2) end end)
script.Parent.TouchEnded:connect(function() t = false end) |
|
|
| Report Abuse |
|
|
mage11561
|
  |
| Joined: 03 Sep 2008 |
| Total Posts: 13217 |
|
|
| 04 May 2012 09:53 PM |
They added TouchEnded?
AWESOME |
|
|
| Report Abuse |
|
|
ozza
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 726 |
|
| |
|
|
| 04 May 2012 10:48 PM |
| Im pretty sure CrazyMan (Some numbers) made one |
|
|
| Report Abuse |
|
|