How to get a distance variable to refresh each frame?

Here’s how it looks when i play it. It works for the first frame, then if i move around it doesn’t change.