So, I've been attempting to create a poison gas object, and the only problem I've faced thus far is damaging others. Using .Touched, whenever the person being effected stops moving, they're not damaged. Using magnitude, I lag half to death. Any ideas? Thanks as usual! :)
There's an event called TouchEnded that does exactly what you think it does. You can combine it with Touched so that they constantly take damage while touching the cloud. Something like this:
01 | touching = false |
02 |
03 | function damage(hit) |
04 | if hit:FindFirstChild( 'Humanoid' ) then |
05 | player = hit |
06 | touching = true |
07 | while touching do |
08 | hit.Humanoid:TakeDamage( 1 ) |
09 | wait(. 1 ) |
10 | end |
11 | end |
12 | end |
13 |
14 | function stoptouch(stopped) |
15 | if stopped = = player then |
16 | touching = false |
17 | end |
18 | end |