How would I use a database to store strings?

In my game, I have a house creation system. Anyone will a certain requirement can create a house, and all it does is changes their house rank and last name in their data. What I wish to do, to make the game more realistic, and make more sense, is to have it to where when a house has already been created, no one else can recreate that house unless I choose to delete it from the database myself.

The script would do these functions in chronological order:

  • Check if the house name is censored or blacklisted
  • Check if the house has already been created by searching though the database
  • If conditions are met, then house name is stored within database
  • Gives player the house rank of Creator and changes their last name

Thank you for reading.

I will not write code for you as I believe that the more you write, the more likely-hood you are to learn and apply it to various other projects down the road. I’ll try my best to point you to the correct place.

A great application for this is a table. You can store keywords (house names) and check to see if the name is valid before pushing to your database.

local blacklist = {

-- Check to see if the name exists in blacklist
if blacklist[houseName] ~= nil then
   -- Code

If you wanted to check to see if the name is appropriate, you could use TextService:FilterStringAsync or String.gmatch to match keywords.

All of this can be accomplished by utilizing datastores. A datastore is a game-specific database that comes free with Roblox through their DataStoreService. It’s quite easy to use but, I will warn you that it’s tedious and can be frustrating but, rewarding like most things.

You could use an external database such as firestore(firebase), cloudstore, MySQL, PostgreSQL, etc but, that’s overkill for most people and requires a RESTful API in order for HttpService to interact with it. In the event that you’re willing to go the more complex route, I’ve listed a few resources to get you started.

This should be more than enough to point you in the right direction. I hope this helps!

Thanks for the insight on the complexity on this. I already know how to create a blacklist table to use, along with TextService’s FilterAsync.

I’ve used DataStoreService before in my games, and I’m currently using it right now to save stats. I see you have listed 2 different routes, and using an advanced database like Firebase, and Google Cloud. Since those are more on the complex side where I am not at yet, I’ve decided to use DataStoreService.

Before making this post in the first place, I have already thought about how to use DataStoreService to store these houses. I would like to ask you how you would, as I have concluded that since I would need a key and value in order to store a data store entry, it would not be the best way to make this. Houses will be stored by name, and not player specific. To simplify it, it would basically be adding those names to the blacklist table I was talking about.

Store the key blacklist and the value { ... } into a datastore. You could cache it on the server to prevent database misuse. The get, set or del operations would be the same for traditional datastores.