code:
local DataStore = game:GetService("DataStoreService") local SaveTools = DataStore:GetDataStore('Save_Tools') ---- game.Players.PlayerAdded:Connect(function(player) local tools = player:WaitForChild('Backpack') for i,v in pairs(tools:GetChildren()) do local data = v local success, errormessage = pcall(function() SaveTools:GetAsync(player.UserId..'-Tools') end) if success then print('Loading tools') local Curr_Tools = data:Clone() Curr_Tools.Parent = player.Backpack if not success then print('Oh no, A error occured!') warn(errormessage) end end end end)
local DataStore = game:GetService("DataStoreService") local SaveTools = DataStore:GetDataStore('Save_Tools') ---- local errormessage = "An error has occured!" game.Players.PlayerAdded:Connect(function(player) local tools = player:WaitForChild('Backpack') for i,v in pairs(tools:GetChildren()) do local data = v local success, errormessage = pcall(function() SaveTools:GetAsync(player.UserId..'-Tools') end) if success then print('Loading tools') local Curr_Tools = data:Clone() Curr_Tools.Parent = player.Backpack if not success then print('Oh no, A error occured!') warn(errormessage) end end end end)
You forgot to put "Local errormessage = "An error has occurred!" "
Let me know if this works.