I’m making a nickname feature, and i want it so only 1 person can have 1 nickname. How would I achieve this.
So you have to store it in the datastore.
When you use a pcall it returns whether if the datastore already exists or not. So if it exists then it returns true (which means name already taken.)
Else it returns false which means u can use it.
You can easily do:
if not (dataStore:GetAsync()) then
-- There is no saved data.
else
-- There is saved data.
end
as I suspect u want to achive a look at your database that would be readable regardless of player actually being in game, right? well in that case you should use DataStoreService | Documentation - Roblox Creator Hub and check if the player key is not equal to nil.
An ordered data store is not needed here. You can simply save the data in a table using Get/SetAsync and read from the table once it has been retrieved. (This is what I did in Ro-Chat)
I am talking about like login system type database where you have a username and if you want to create a new account u need to first check if that username is available and u cant store that kind of database to a player
Yes, that’s the same system we have.
Oh my bad, I thought u are asigning a table to the player… I am just not used to regular ds since I use ds2 module all the time