Can you change your username during gameplay?
Can this change ‘Player.Name’ property ?
Sorry for my english.
Can you change your username during gameplay?
Can this change ‘Player.Name’ property ?
Sorry for my english.
No, you cannot do this. Not sure why you would want to.
No, you can’t change the name of the Player object. The Properties panel will let you enter a different name into the field, but it still won’t change anything. This is probably to prevent impersonation, and to generally keep things from breaking.
if the property changes, my scripts will be broken
Yes, both Server Sided Scripts and Local scripts cannot change this.
A good alternative (In my opinion) would be disabling the default name tag, which could be achieved by setting the humanoid property “DisplayDistanceType” to “None” and creating your own name tag. Personally I use Billboard GUI’s to do so.
I think the other replies may have misinterpreted your question. As far as I know, if a player changes their username on the website, it won’t change in game until they join a new game. The current game they are in will continue to see the old username until they leave.
Is there a specific reason why you’re asking this question? Generally, as a rule of thumb when working with Players, you should never be referencing them by username, only by their UserId. Names can change while UserIds are unchanging and permanently attached to names. Any of your code that references players by a username, change it to use UserIds.
You can fetch a player’s current username by passing their UserId to Players.GetNameFromUserIdAsync, or get the UserId associated with a username by using its counterpart, Players.GetUserIdFromNameAsync.
Your question in general though: yes you can change your username during gameplay, but the name property won’t update until a new session of Roblox starts up.
If you meant changing the nickname meaning it will show on the leaderboard a different nickname, you might need to create a leaderboard yourself instead of using the default leaderboard. I think it may still show the original username to prevent inpersonation.
Changing a username on Roblox which will be kept permanently wouldn’t be possible as it would require the user to pay.
EDIT: Do you mean change the username on the website while in game or changing it in game temporarily?
But does this mean that it is possible for 2 players to have the same name momentarily?
No, not possible. Once a username is used, it can’t be used by anyone else. No two players will ever have the same name.
so. If I change my name to its_trolltime2, can anyone take “its_trolltime”?
No.
A username is permanently associated with a UserId once it’s used. No one can take a used username.
Lol roblox thought of all possible hacks. thanks
Just be sure not to use usernames for things such as datastores. Use User Ids instead.
I am not using usernames for that or for leaderboards or anything like that XD
Please note that impersonation is actually possible using Xbox. Xbox requires players to be displayed by their gamer tag and not their username, so it is my understanding that it is possible for two players to have the same username via having the same gamer tag. I’m not sure how this affects cross-platform play.
Fair point. I believe this was resolved regarding cross-platform play though.
Relevant feature request I made long ago:
The catch-all case would probably be just to use UserId, not username. All codework should be done using UserId and username only being used for display purposes.