Hello there! This can be really easy made with this module. A simple example to do it for your case would be:
local zone = require(...) -- the location for your zone module
local wallsFolder = ... -- put your walls in a folder and reference them here
local globalChecker = {}
for _, wall in ipairs(wallsFolder:GetChildren()) do
local zone = Zone.new(wall)
zone.playerEntered:Connect(function(player)
globalChecker[player] = true
local character = player.Character
local humanoid = character.Humanoid
task.spawn(function()
while globalChecker[player] do
humanoid:TakeDamage(5)
task.wait(1)
end
end)
end)
zone.playerExited:Connect(function(player)
globalChecker[player] = false
end)
end
Didn’t test this, but pretty sure it will. If someone finds an error, let me know it to correct it!