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")