Let’s say I want to make “!admin playerName” but this player currently not in game but already join the game once before, is it able? Maybe using UserId.
You prolly have a datastore to store ranks, so just update the rank of the said player.
Use Players:GetUserIdFromNameAsync() and save the ID to a datastore then give the player admin when he joins
As @Mystxry12 and @NinjaFurfante07 said,
You’ll need to store the player’s ID in data store, and whenever he joins the game, give him his rank.
When you’re working with admin and you give ranks, it’s preferred to use players’ ID rather than their names, because their names can be changed, while their ID can’t.
But I supposed you can still using name right? then use Players:GetUserIdFromNameAsync()
You technically can save their names, but it’s preferred to use their id, in case they’ve changed their username.
Yes, you can use
GetUserIdFromNameAsync() function to get the player’s id from his name, and then store it in your data store. And when that player joins again, give him his rank if he is indeed an admin.