Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Two Region3s not working properly/broken?

Asked by
trecept 367 Moderation Voter
5 years ago
local spawnarea= Region3.new(Vector3.new(10, 10, 10), Vector3.new(100, 100, 100))
local fightarea= Region3.new(Vector3.new(900, 900, 800), Vector3.new(1000, 200, 900))

while wait(1) do
    local s = game:GetService("Workspace"):FindPartsInRegion3(spawnarea, nil, math.huge)
    local f = game:GetService("Workspace"):FindPartsInRegion3(fightarea, nil, math.huge)
    for i,v in pairs(s) do
        if v.Parent:FindFirstChild("Humanoid") then
            print("1")
        end
    end
    for i,v in pairs(f) do
        if v.Parent:FindFirstChild("Humanoid") then
            print("2")
        end
    end
end

I have tried countless times and I'm so lost. I have two region3s to check for players in areas so I can change health if they're in safe zone or not. They spawn in the safe zone. However, the "fightarea" region3 just never seems to work. 2 is never printed, however the "spawnarea" region3 always works, and 2 is always printed when they are inside and not when they're outside. Why does the second region3 never work?

Answer this question