I've noticed several mistakes in your script, but the main thing I want to point out is your misuse of variables. You see, if you set for example the {x} variable to the player's variable, then the player's variable would be the same for everyone, and would change constantly.
Use local variables instead, {_x}, {_y}, {_z}.