Script in serverScriptService wont be read

Heya ! I dont know why, but my script wont be read … i change a lot of thing, but nothing change, the script wont be read. BUT, when i test the game in studio, it works. Why ? xD

local DS1 = game:GetService("DataStoreService"):GetDataStore("YourDataStore2")
local replicatedStorage = game:GetService("ReplicatedStorage")
local guiInscription = game.ReplicatedStorage.Inscription.ScreenGui
print("pas nouveau")

game.Players.PlayerAdded:Connect(function(plr)

	local leaderstats = Instance.new("Folder", plr)
	leaderstats.Name = "leaderstats"

	local currency = Instance.new("IntValue", leaderstats)
	currency.Name = "fdp" -- Name it whatever you like
	currency.Value = 0 -- Starting currency

	local firstJoin1 = Instance.new("BoolValue", plr)
	firstJoin1.Name = "FirstJoin"
	firstJoin1.Value = true -- Starting by true

	local data;
	local success, err = pcall(function()
		data = DS1:GetAsync("YourKey"..plr.UserId)
	end)
	print("pas nouveau")

	if data then
		-- it is not a new player --
		firstJoin1.Value = data.FirstJoin
		currency.Value = data.fdp
		
		print("pas nouveau")

	else
		-- it is a new player --
		-- it is a new player --
		print("Welcome to "..plr.Name.."!")
		local guiClone = guiInscription:Clone() -- Clone the GUI
		guiClone.Enabled, guiClone.Parent = true, plr.PlayerGui -- Enable it and put it in PlayerGui
		print("nouveau")

	end
end)
print("pas nouveau")

	-- And you can save like this : 

	game.Players.PlayerRemoving:Connect(function(plr)
		local data = {FirstJoin1 = false, fdp = plr.leaderstats.fdp.Value}
		local success, err = pcall(function()
			DS1:SetAsync("YourKey"..plr.UserId, data)
	end)
end)
print("pas nouveau")

Make sure that your studio can access to datastore.

1 Like

ok, but it not solve the problem. When i play the game, the script wont be read. Its only in studio where the script is read

SERVERSCRIPTSERVER

Ok that’s hilarious

Are there any errors on the Output at all?

1 Like

haha i change that xdd no, no errors , no print

You say no prints, when you mean that do you mean like nothing’s printing from your Output at all?

1 Like

every print i try to print in this script are not print

The only thing I can think of is what type of script it is, where it’s located, and check if it’s disabled or not

It should be a ServerScript within ServerScriptService, and the Disabled property should be set to false?

1 Like

You can use built-in debug tool to run script line-by-line

1 Like

as you can see, everything is fine in there …

i think i will rewrite all the script, because i dont know where the error is.

i found the solution : the script was uncommited :confused:

1 Like