THIS SCRIPT ALWAYS WORKS BUT ITS ONLY LOADING WEAPONS WHEN U JOIN AND NOT SAVING THEM WHEN U LEAVE SO IF U GET A NEW WEAPON IS DOESNT SAVE PLS HELP ME
local ds = game:GetService("DataStoreService"):GetDataStore("ToolSave")
game.Players.PlayerAdded:Connect(function(plr)
local key = "id-"..plr.userId
pcall(function()
local tools = ds:GetAsync(key)
if tools then
for i,v in pairs(tools) do
local tool = game.ServerStorage.Tools:FindFirstChild(v)
if tool then
tool:Clone().Parent = plr:WaitForChild("Backpack")
tool:Clone().Parent = plr:WaitForChild("StarterGear")
end
end
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local key = "id-"..plr.userId
pcall(function()
local toolsToSave = {}
for i,v in pairs(plr.Backpack:GetChildren()) do
if v then
table.insert(toolsToSave,v.Name)
end
end
for fuck, you in pairs(plr.Character:GetChildren()) do
if you.ClassName == "Tool" then
table.insert(toolsToSave,you.Name)
end
end
ds:SetAsync(key,toolsToSave)
end)
end)

3 comments
Why does line 27 have the F word on it?
You definitely should not be using curse words in your code. Roblox goes through code, and that can get you banned and or terminated.
oh i didnt know ill remove it sorry