Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Creating poison gas?

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! :)

3 comments

0

I came up with a runaround, for those who are interested. Basically, I just put those who touched the object into a table, and then put in a loop that took said person's magnitude. If they went out of the distance, they stopped getting damaged, whereas if they went back and touched the object, they got damaged again.

0

Lol, I crashed my studio trying to help

0

Haha, I know the feel. Thanks for the effort!

1 answer

✓ Accepted answer

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:

touching = false

function damage(hit)
	if hit:FindFirstChild('Humanoid') then
		player = hit
		touching = true
		while touching do
			hit.Humanoid:TakeDamage(1)
			wait(.1)
		end
	end	
end

function stoptouch(stopped)
	if stopped == player then
		touching = false
	end
end

1 comment

0

I hadn't known about .TouchEnded, that'll be really helpful now and later. Thanks so much! ^^

This discussion is preserved as it was. New answers, comments, and votes are closed.