The issue is rather with your code.
The touch.XforID/YForID will have a value only when you are touching (so should rather happen in a "On touched" event for example, not be delayed to another event).
Also it's expecting a "Layer" parameter which isn't available in what you show there.
Prefer sharing a full capx for investigation, but as far as I can tell, the issue is with your code, not with a C2 feature.