How to auto scale a material that isnt just a texture?

So ive looked for how to scale but seems its all just for texture scaling. I followed a tutorial to make a grid material but it just stretches out when scaling objects instead of adding more grid.

what it looks like(how i want it to look)

when scaling(what i want to fix):

found a easy fix. i already knew world position worked but didnt like that the material would move as the object moved around so have to just get the pivot point location.

image