Snapping to grid help

Im trying to make a gold storage snap to the position of the mouse on the x and y axis for every 5 units. Don’t know why this isnt working any suggestions (very very new to coding in general lol)

void Update () {
if (Input.GetMouseButtonDown(0))
{
selectedObject = goldStorage.transform.position;
var currentPosMouse = Input.mousePosition;
selectedObject = new Vector3(Mathf.Round(currentPosMouse.x * 5), Mathf.Round(currentPosMouse.y * 5));
}
}

Is not really physics question, isn’t it?

instead of
selectedObject = goldStorage.transform.position;

you want assign transform reference
Transform selectedObject = goldStorage.transform ;

then
selectedObject.position = …// your new vector