Whenever I run the following code, I only get the “Working” print once, sometimes twice, even though from my understanding of the code it should run over and over again every second. After doing some print testing, I found out that the code stops printing anything after the first for loop. I’ve never run into this problem before
--Variables--
local currentLocation = nil
local wasFound = false
while true do
for currentPart, section in pairs(workspace.locationChangers:GetChildren()) do
local pos1, pos2 = (section.Position - section.Size / 2), (section.Position + section.Size / 2)
local region = Region3.new(pos1, pos2)
local playersFound = game.Workspace:FindPartsInRegion3(region)
for i, playersInArea in pairs(playersFound) do
if playersInArea:FindFirstAncestor(char) then
if currentLocation ~= currentPart.placeName.Value then
--Change the Location--
currentLocation = currentPart.placeName.Value
wasFound = true
print("working")--(section.placeName.Value, section.placeOST.Value, section.placeAmbience.Value, section.placeDescription.Value)
end
end
end
--They weren't found--
if wasFound == false then
--TO THE VOIDZONE WITH YOU--
print("working")--("The Voidzone", nil, game.SoundService.voidzone, "A place beyond the 4 realms, where nothing should exist, yet you're watched as you travel through the flat land", game.Lighting.voidzoneColorCorrection)
end
end
wasFound = false
wait(1)
end