Region3 doesn't detect spawned player

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want the region to detect the player even if they just spawned

  2. What is the issue? It doesn’t detect it when I spawn inside the region.

  3. What solutions have you tried so far? I’ve searched all around devForums, youtube videos and re-checking my scripts.

Script:


for i, v in pairs(locations:GetChildren()) do
	local region = Region3.new(v.Position - v.Size/2, v.Position + v.Size/2)
	
	local locationCoroutine = coroutine.wrap(function()
		while true do
			wait()
			local partsinRegion = workspace:FindPartsInRegion3(region, v)
			for index, part in pairs(partsinRegion) do
				if part.Parent:FindFirstChild("Humanoid") ~= nil then
					print("PlayerFound")
					local player = game.Players:GetPlayerFromCharacter(part.Parent)
					if player.CurrentLocation.Value ~= v.CityName.Value then
						replicatedStorage:WaitForChild("ChangeCity"):FireClient(player, v)
						player.CurrentLocation.Value = v.CityName.Value
					end
				end
			end
		end
	end)
	locationCoroutine()
end