Sorry for not replying. I just repair it and it works well. The variables were changing every tick when it was on one of the layouts to the text or number that was wrote in a textbox. The problems have been starting every time I was changing the layout. Then the textboxes were just getting empty, but in code, the variables still were changing to the value in the textbox. I just added new 'if' which checks if the layout in which are these textboxes is currently open to the function which is responsible for changing the value of the variables.
I'm sorry if I wrote this text kind of chaotically, but my English is no perfect and I'm still learning it.