My initial datastore loader only runs sometimes?

I’m quite confused this has never happened to me before.


local DataStore2 = require(1936396537)
local RS = game:GetService("ReplicatedStorage")
local StartTutorial = RS.Events.StartTutorial

DataStore2.Combine("DataStore", "Key1", "Key2")
print("ran") -- this always prints

local function DefaultData()
	local PetSimulatorData = {
		Misc = {
			["First time playing"] = true;
		Moolah = {
			["CurrentMoolah"] = 0;
		OwnedPets = {
			["Pig"] = false;
	return PetSimulatorData

	print("got player") -- this rarely prints, for some reason, the playeradded isnt firing??
    -- rest of code

The script is in a folder in ServerScriptService, what confuses me the most is it seems to work but only runs sometimes?
A theory I have is that the DataStore2 roblox asset module could be deprecated or something but I don’t see how that would affect anything, studio access to API services and HTTP requests are both on.

Ok it turns out when you go PlaySolo mode in studio, PlayerAdded doesn’t fire.
Works fine in-game and a workaround is using a getplayers loop in studio.

Dunno if this is a bug or not :man_shrugging:

I’m not entirely sure what is running when you do DataStore2.Combine(because I haven’t used DataStore2 much), but I believe that it is running something that could yield until it is completed. By the time that it’s done, the player has already been added to the game, hence the playeradding function not working.

Why it runs in the game versus in studio, no clue, but it could be a difference between how a studio server starts up versus how a game server starts up.