I'm trying to test out some stuff and i made a storm module and its broken because it damages players even if they're in safe zone here's some code if you wanna find out the solution
local function IsInRegion(Player)
for a,b in pairs(workspace:FindPartsInRegion3(Region3FromPart(workspace.World.StormRegion),workspace.World.StormRegion,math.huge)) do
if b.Parent == Player or b.Parent.Parent == Player then
print("Safe")
return true
end
end
print("Damage") --This is for testing
return false
end
Other code
function self:Initialize()
Initialized = true
spawn(function()
while wait(2) do
if not Initialized then break end
for a,b in pairs(game.Players:GetPlayers()) do
if b.Character then
if IsInRegion(b.Character) then
else
b.Character.Humanoid:TakeDamage(math.random(1,5))
end
end
end
end
end)
end
Footage: Photo Any way i can fix it?

5 comments
omg just put on a god damn forcefield when they go in there and remove it when they go out
i dont like putting force fields
Why not?
Jesus Christ GamePlayer. Also for ForceFields they have a boolean property called "Visible" that when toggled, changes whether or not the ForceField will be visible to everyone
FindPartsInRegion3 is resource heavy and by default returns only maximum 20 parts. You may want to increase that limit, or use FindPartsInRegion3WithWhitelist instead, and add characters to that list. However I would just check HumanoidRootPart position on each player instead. Much more efficient.