upon the character leaving the reigon3 (which is supposed to return nothing with “:FindPartsInRegion3WithWhiteList” allowing the script to run past “else”) the script will tell itself the player isn’t inside a region and will display “wilderness” instead of a proper region.
for i,v in pairs(Reigons:GetChildren()) do
--current_reigon = "Wilderness"
local reigon = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2))
local FoundInReigon = game.Workspace:FindPartsInRegion3WithWhiteList(reigon, Character:GetDescendants())
for _, part in pairs(FoundInReigon) do
if FoundInReigon then
if current_reigon ~= v.Name then
current_reigon = v.Name
framework:WaitForChild("Remotes").ReigonChanged:FireServer(v.Name, v.Description.Value)
end
else -- THIS DOES NOT FUNCTION FOR WHATEVER REASON!
current_reigon = nil
end
end
end
There will be no index for player or parts that are not inside a region. The Found in Region only returns players and parts that are inside. You can possibly bind a .TouchEnded to the player or region to fire a signal whenever the player is no longer in contact with a region though.
Unrelated comment: Please refrain from using deprecated functions. It is an inherent design flaw. They could at any time break internally and Roblox won’t fix it. It could be broken right now which is why you’re having this problem. You should be using the spatial query API as a superior replacement.
I’ve tried :GetPartBoundsInBox() but neither has it reacted to “else”, so i ended just ctrl-z’ing until the original functionality was back. i should’a mentioned that…