You were kicked from this experience:

Screenshot_472
I made a game back then, and my old data was loaded. However, when new players join into the game, they are greeted with this message above. I wasn’t sure how to solve this problem so I went ahead and created an alt to see if that is true, and I do have the same message as above. After I data reset, now that when I join the game on my main, I am greeted with this same message again.

1 Like

When you look for a player’s data from a datastore and the player has no data (usually first-time players), the datastore returns nil. Most likely your code has it so if nil is returned then it assumes there was an error and kicks the player.

I would make sure in the code that you are not kicking players where the datastore data returns nil, but only kick players if the datastore function had an error which can be caught using pcall().

Oh, I assume that would be my problem. But the thing is, I really don’t know where to start with 4000+ lines of datastore and I’m a bit nervous to change any of it. Even F9 isn’t showing me anything related to datastore or errors.

I would search for the kick function call, by searching the string sent in the kick message, “Your data hasn’t been loaded, please rejoin the game” , because that text would be located in the code as a parameter of the kick function.

CTRL + F (find shortcut) within datastore scripts until you find that string that is being sent as a parameter. Then if the kick is within an if statement, most likely it would look something like this:

-- bad code
if data == nil then
    player:kick("Your data hasn't been loaded, please rejoin the game.")
end

Also, hopefully there would also be code similar to this getting the player’s data

-- getting player data
local success, result = pcall(function() 
    return datastore:GetAsync(player.UserId)
end)

And you would replace the kick if statement with

--checking for errors
if not success then
    player:kick("Your data hasn't been loaded, please rejoin the game.")
end

Since I don’t have access to the code, it’s very hard to guess how the code was written, so my examples might not even be close to how your game’s code works. But this would be my best bet, and is the best I can do to try to help.

1 Like

Yeah, it’s nowhere near close to my code but since I did get an idea where it came from and started finding my own error, this helps a lot. Thank you so much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.