BlasterBladethefox

Untitled

Apr 22nd, 2021
695
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ds = game:GetService("DataStoreService"):GetDataStore("ToolSave")
  2. game.Players.PlayerAdded:connect(function(plr)
  3.  local key = "id-"..plr.userId
  4.  pcall(function()
  5.   local tools = ds:GetAsync(key)
  6.   if tools then
  7.    for i,v in pairs(tools) do
  8.     local tool = game.ServerStorage.Tools:FindFirstChild(v)
  9.     if tool then
  10.      tool:Clone().Parent = plr:WaitForChild("Backpack")
  11.      tool:Clone().Parent = plr:WaitForChild("StarterGear")
  12.     end
  13.    end
  14.   end
  15.  end)
  16. end)
  17. game.Players.PlayerRemoving:connect(function(plr)
  18.  local key = "id-"..plr.userId
  19.  pcall(function()
  20.   local toolsToSave = {}
  21.   for i,v in pairs(plr.Backpack:GetChildren()) do
  22.    if v then
  23.     table.insert(toolsToSave,v.Name)
  24.    end
  25.   end
  26.   ds:SetAsync(key,toolsToSave)
  27.  end)
  28. end)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×