EDIT: I solved this myself, you can see my answer below
So I was making a system where a label would pop up on the screen showing the location name if the player entered said location. It used to work until after I added the code to test if the player isn't in the area anymore. NOTE: It's not because of multiple locations. There are two of these scripts existing but I commented out the code to set it to "The Wilderness" from the other localscript and it still happened.
Code:
wait(5)
local player = game.Players.LocalPlayer
local Part1 = script.first
local Part2 = script.second
local region1Upper = Vector3.new(
math.max(Part1.Position.X, Part2.Position.X),
math.max(Part1.Position.Y, Part2.Position.Y),
math.max(Part1.Position.Z, Part2.Position.Z))
local region1Lower = Vector3.new(
math.min(Part1.Position.X, Part2.Position.X),
math.min(Part1.Position.Y, Part2.Position.Y),
math.min(Part1.Position.Z, Part2.Position.Z))
local region = Region3.new(region1Lower, region1Upper)
local inArea = false
while wait() do
inArea = false
for i,v in pairs(workspace:FindPartsInRegion3(region,nil,100)) do
if v.Parent.Name==player.Name then
print (v.Parent.Name)
game.ReplicatedStorage.AreaLabel.Value = "Home Base"
inArea = true
end
end
if game.ReplicatedStorage.AreaLabel.Value == "Home Base" and not inArea then
game.ReplicatedStorage.AreaLabel.Value = "The Wilderness"
end
end
