I am having an error with my Tool Save script.
ServerScriptService.ToolSave:18: Expected ‘)’ (to close ‘(’ at line 15), got ‘end’
local service = game:GetService("DataStoreService")
local ds = service:GetDataStore("ToolsData")
local folder = game.ReplicatedStorage.Tools
game.Players.PlayerAdded:Connect(function(plr)
local toolsSaved = ds:GetAsync(plr.UserId .. "-tools") or {}
for i, toolSaved in pairs(toolsSaved) do
if folder:FindFirstChild(toolSaved) then
folder[toolSaved]:Clone().Parent = plr.Backpack
folder[toolSaved]:Clone().Parent = plr.StarterGear
end
end
plr.CharacterRemoving:Connect(function(char)
char.Humanoid:UnequipTools()
end
end
game.Players.PlayerRemoving:Connect(function(plr)
local toolsOWned = {}
for i, toolInBackPack in pairs(plr.BackPack:GetChildren()) do
table.insert(toolsOwned, toolInBackPack.Name)
end
local success, errormsg = pcall(function()
ds:SetAsync(plr.UserId .. "-tools", toolsOwned)
end
if errormsg then
warn(errormsg)
end
end)