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)
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
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.
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?