Why your data store script is not working on Studio (possibly)

Have you ever been at that situation where you are making a really simple data store script and then it doesn’t work? Your first reason is to maybe look at other YouTubers Data Store Script, since they are working in the video but to no success either. You ask ChatGPT, which couldn’t help you either. So now you are stuck. How do we fix your Data Store Script?

To put it simply: It is not the script’s fault, it’s yours.

This is your really typical Data Saving Script. But why is it not working when this is the usual way?

Well the problem is on the PlayerRemoving function. If you didn’t know, basically testing on Studio is just an Simulation; it simulates a server, a fake server to say. Once the Player leaves the Simulation, the Server will be closed. See the problem now?

Every script that is running INCLUDING Server Script just stop immediately once the Server shuts down. And you might say "Man what a dumb dumb, just use game:BindToClose :nerd_face: :point_up: ". Sorry to disappoint but that is also affected. A real shutdown waits a bit of seconds until it will then close all server. In this time frame, the function will be called then. On Studio however, it will shut down immediately, no waiting time.

How do we fix your issue now after this yapping?

A method I found recently which worked 100% (Well except of data throttling) is that you change to the Server’s perspective. That icon:
image to → image

Now once you done it, change the Variables you want to change on the Server and now you type in this in the command bar once you made some Variable Changes:

game.Players.PLAYERNAME:Kick()

Voila, Script “fixed”. One odd thing you may see is that on the client you are not kicked, but you are. And that is how you keep the Server running! If you have followed this tutorial you earn this star:
image

Now ofcourse this doesn’t have to be the reason at all, most common mistakes I see is that people change them on the client instead of the Server. This post is just there to remind people on why it is not working on Studio (possibly)

3 Likes