Raycasting only detects close to model

I have an AI that is supposed to detect the player by using a raycast. However this only seems to work if the player is within 1 unit of the AI. The script is attached the the empty gameobject but I have used a layermask to stop the raycast hitting the children. However the raycast still only detects the player within an extremely close range. Any ideas on why this is happening? Here is the code segment:

		Debug.DrawRay(transform.position, transform.right, Color.green)
		if Physics.Raycast(transform.position,transform.right,hit,200,2):
			print("hello")
			if hit.transform.parent.name == "Player":
				followingplayer = 1

Debug.DrawRay(transform.position, transform.right, Color.green)
if Physics.Raycast(transform.position,transform.right,out hit,200,2):
print(“hello”)
if hit.transform.parent.name == “Player”:
followingplayer = 1

without the asterisks