local Players = game:GetService("Players")
local DataStoreServices = game:GetService("DataStoreService")
local MyData = DataStoreServices:GetDataStore("Player_Upgrades")
Players.PlayerAdded:Connect(function(Player)
local Player_Key = "Key_ "..Player.UserId
local Data = MyData:GetAsync(Player_Key)
print(Data)
local Folder2 = Player:WaitForChild("Stats")
if not Folder2 then
Folder2 = Player:WaitForChild("Stats")
end
local CL = Instance.new("NumberValue")
CL.Name = "Level_CoolDown"
CL.Parent = Folder2
if Data then
CL.Value = Data[1]
else
CL.Value = 1
end
CL.Changed:Connect(function()
MyData:SetAsync(Player_Key, {CL.Value})
end)
end)
Players.PlayerRemoving:Connect(function(Player)
local Player_Key = "Key_ "..Player.UserId
local Folder2 = Player:FindFirstChild("Stats")
local Values = {Folder2.Level_CoolDown.Value}
local Success, Errorm = pcall(function()
MyData:SetAsync(Player_Key, Values)
end)
if not Success then
print(Errorm)
end
end)
I dont know the issue, all the datastore but this one doesn’t.