How do i get the enemys to follow me

hi i have enemys in my game and in it they arent following me can u tell me whats wrong with this code:

on enemyMoveUpdate do
newEnemyX = event.x
newEnemyY = event.y
if event.pxnewEnemyx then
newEnemy++
end

tileAtNewPos = name newEnemyX,newEnemyY
if tileAtNewPos!="white" then
	newEnemyX = event.x
end
if event.py<newEnemyY then
	newEnemyY--
elseif event.py>newEnemyY then
	newEnemyY++
end
tileAtNewPos = name newEnemyX,newEnemyY
if tileAtNewPos!="white" then
	newEnemyY = event.y
end
swap "white"
tell newEnemyX,newEnemyy to
	swap "enemy"
end

end

make sure the code is put in the right spot. game script, and i think enemy script. also make sure the names are correct on your sprites or items. capitilization or lower case.

also i see an issue right near the bottom
end
swap "white"
tell newEnemyX,newEnemyy to

  • swap "enemy"*
    end

the newEnemyY i think is your issue there