So whenever I exit out of Play test in the studio I get that in the output. HEres the script
local DataSaveService = game:GetService("DataStoreService")
local stat = DataSaveService:GetDataStore("Stats")
game.Players.PlayerAdded:Connect(function(plr)
local attributes = Instance.new("Folder", plr)
attributes.Name = "Attributes"
local breathing = Instance.new("IntValue", attributes)
breathing.Name = "Breathing"
local health = Instance.new("IntValue", attributes)
health.Name = "Health"
local speed = Instance.new("IntValue", attributes)
speed.Name = "Speed"
local breathings
local healths
local speeds
-- data store time :)
local success, errormsg = pcall(function()
breathings = stat:GetAsync(plr.UserId.."-Breathing")
healths = stat:GetAsync(plr.UserId.."-Health")
speeds = stat:GetAsync(plr.UserId.."-Speed")
end)
if success then
breathing.Value = breathings
health.Value = healths
speed.Value = speeds
print("The player data has been saved") -- this will print if the scrip successfully loaded the players data
else
print("player data load error") -- this will print if the player's data failed at loading
warn(errormsg) -- this will tell the problem of the load error
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormsg = pcall(function()
stat:SetAsync(plr.UserId.."-Breathing", plr.Attributes.Breathing.Value)
stat:SetAsync(plr.UserId.."-Health", plr.Attributes.Health.Value)
stat:SetAsync(plr.UserId.."-Speed", plr.Attributes.Speed.Value)
end)
if success then
print("Player data got saved")
else
print("Failed at saving data")
warn(errormsg)
end
end)