You can use the USERNAME
environment variable, which seems to be defined by default on Windows, macOS and Linux:
var username
if OS.has_environment("USERNAME"):
username = OS.get_environment("USERNAME")
else:
username = "Player"
The snippet above falls back to Player
if the environment variable doesn't exist for some reason.
Keep in mind this may not be a good solution for multiplayer games, as many people use their real name as their computer user name and would rather stay anonymous.