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

How do I make it so that toxic fumes won't damage a player with a gas mask?

In my game, there are parts with toxic fumes that require a gasmask to pass through. (undamaged, that is) But, I dont know how to make it so that if a player is wearing a gasmask, then the toxic fumes wont damage him. I don't know if this is necessary (or even helps) but I'm new here on this site, so some things that may or may not help: The gas mask is currently a hat, and the fumes are basic bricks that are scripted to do damage when touched.

1 comment

1

Note: Despite what the other questions are on this website, you're not supposed to post requests despite it being lowly enforced.

2 answers

--Define the player
--Define the players character
if character:findFirstChild("GasMask") then
--stuff
end

If there is something touching the gas then search for a humanoid. If there is a humanoid then check if they have a gas mask. If they don't, make a debounce and deal damage to the humanoid, wait a set time, then set the debounce back.

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