So basically I'm trying to make something that where if you are in it and a button is pressed, that it'll just kill you. It's working for if you walk into the zone when its active, but if you are already standing in said zone it won't kill you and you can walk around the room. I'm not the best with coding so excuse any crappy code and such. I've made it so, using a value when a button is pressed which required another script, it turned either the value true or false which in turn, would allow the script to actually kill those who step inside the zone or to stop that from happening when it was deactivated.
local KillBrick = script.Parent -- Name of the kill zone,
local active = script.Parent.Parent.Value - The value.
KillBrick.Touched:Connect(function(plr)
if active.Value == true then
local h = plr.Parent:FindFirstChild("Humanoid")
if h ~= nil then h.Health = 0
end
end
end)
