Hazmat suit and area

So I’ve got a hazmat suit and an area where I want people to take damage if they don’t have a suit on. This is what I have so far but I’m stuck on where to say if they have the hazmat suit on don’t do damage.

local healthLoss = 10 
local coolDown = 1
local loseHealth = true
function killBrick(hit)	
	local a = hit.Parent:findFirstChild("Helmet1")
	local h = hit.Parent:findFirstChild("Humanoid")
	if h~= nil and loseHealth == true then
		loseHealth = false
		h.Health = h.Health - healthLoss
		wait(coolDown)
		loseHealth = true
	end
	end
script.Parent.Touched:connect(killBrick)

Any help would be nice thanks

2 Likes

Where it says
if h~= nil and loseHealth == true then
You can just add a check to see if the player is not wearing the Hazmat Suit like this for example
if h~= nil and loseHealth == true and not hit.Parent:FindFirstChild("HazmatSuit") then

1 Like

I’ll try this out thanks for the help!

Hey I also had this same issue.

Althought instead of having a broken script, I dont know how to do this entire thing all together. Any help?

You could use a conditional statement checking whether a player has the suit equipped or not. If they do, they are safe(If statement), and if they do not(else statement), then they are not safe.

Idk much about scripting. I get the if part but what do I put in it.

I gave up on the project I was working on a year ago but, use the script above,

and then add this to where this guy said to add it

If I remember right that should have worked. Might want to add a wait() somewhere in there

Thats cool and all but how do I modify this so it also works for my hazmat suit. (Something like firstchild or something)

Yea I would say look for a part of the hazmat suit that has a name that special then find the child and if that person has it on it doesn’t do damage other wise it does.

I have a similar issue where if a player with a hazmat suit would enter the area where they take damage with a player without one, then neither player takes damage, any idea how to fix that?