Hello!
I'm trying to dynamically track the position of one character relative to another so that something happens. In definition script:
please tell me why it works like this?
function checkCharPos()
  if game.CurrentCharacter.Position.x == Characters["name"].Position.x then 
  print("yes") 
  else
  print("no") 
  end
end
registerEventHandler("mainLoop", "checkCharPos") this does not work:
And this does not work:
local pos1 = game.CurrentCharacter.Position.x
local pos2 = Characters["name"].Position.x
function checkCharPos()
  if pos1 == pos2 then
  print("yes")
  else
  print("no")
  end
end
registerEventHandler("mainLoop", "checkCharPos")
???
Thank you