I am trying to make a gui pop up when a player enters an area and with the research that i have conducted, i have been advised to use Region3 to deal with detection. I have a folder in the workspace containing two locations that i'd like to detect. Upon testing, if i step in one part, everything works perfectly fine and distingushes whether im inside or outside. However if i step into the second part, it says that i am in the part and out of the part straight after :(
local locations = game.Workspace.Plots:WaitForChild("Border")
local Found = false
while wait(1) do
for i,v in pairs(locations:GetChildren()) do
Found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region,game.Players.LocalPlayer.Character:GetDescendants())
for _,part in pairs(parts) do
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
Found = true
break
else
Found = false
end
end
if Found == true then
game.Players.LocalPlayer.PlayerGui:WaitForChild("HomeIcon").Enabled = true
print("In")
break
else
game.Players.LocalPlayer.PlayerGui:WaitForChild("HomeIcon").Enabled = false
print("Out")
end
end
end
