For this you need to create an autoload script(say PlayerVariables) and declare a variable in that (say PlayerPosition) then you can simply access and change that variable for now use this code in your player’s script.
first create a script and write every variable that you want to make global
then go to projects->projects settings-> autoload tab
click the folder icon to browse your script
In the ‘node name’ write name by which you want to access the script (for example write “global” )
and click Add
now your script is available globally and so the variable inside it.
to access any of the variable write < node name >. < your variable name >
in our case ‘node name’ is global.