Hello ! I marked the point at which I don’t understand at : " – from here to the very bottom, I don’t understand what these lines are for" in the script.
I explain, whether I put all these lines, or not, the backup is done the same way, in all the tutorials I saw, the developers put these lines (they script was often different of mine), but with my script I don’t feel that they have any interest since the PlayerRemoving performs the backup, or the automatic backup every 2 minutes that I added (or the BindToClose). Does anyone know if this is of any interest in my case? I can put the whole script if necessary (it’s a bit long)
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "Creatures"
folder.Parent = player
local data
local success, errorMsg = pcall(function()
data = DataStore:GetAsync(player.UserId)
end)
for _, cName in pairs(data) do
if workspace.Creatures:FindFirstChild(cName) then
local newval = Instance.new("BoolValue")
newval.Name = cName
newval.Parent = folder
print("dataok")
end
end
-- from here to the very bottom, I don't understand what these lines are for
if success and data then
print("hi")
else
print("no data")
wait(5)
if success and data then
print("data21")
else
wait(10)
if success and data then
print("data21")
else
wait(10)
if success and data then
print("data21")
else
player:Kick("Your data failed to load ! We are sorry, Please rejoin")
end
end
end
end