DataStore2 Error: DataStore name is too long

  1. What do you want to achieve?
    I want to create a DataStore using DataStore2.
  2. What is the issue?
    When creating the DataStore, it returns the error “DataStore name too long.”
  3. What solutions have you tried so far?
    Changing the length of the mainKey when combining with another string.

The length of the main key is 4 characters and the string I’m combining with is 11.

local success, errormessage = pcall(function()
	print("I changed the userdata datastore name.")
	UserData = dataStore2("UserData", player):Get(setDataTable())
end)

if success then
	print("Successfully got UserData table.")
else
	warn("Error while getting UserData table: "..errormessage)
end

The max length for a datastore name is 50 characters. Are you sure you are combining them to get 15 chars? You shouldn’t get that error unless the string length is actually above 50. Can you do

string.len()

on the key please and double check this?

I checked the length of every string combined that is used to create the DataStore and its 27 characters.

I just replaced the “UserData” string for creating the DataStore to the mainKey and it works now.