local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("Inventory")
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(character)
local Items = ds1:GetAsync(plr.userId)
if Items ~= nil then
for i,v in pairs(Items) do
if game.ServerStorage.Tools:FindFirstChild(v) ~= nil then
local Tool = game.ServerStorage.Tools:FindFirstChild(v)
Tool.Parent = plr.Backpack
end
end
end
end)
end)
game.Players.PlayerRemoving:connect(function(plr)
local Table = {}
for i,v in pairs (plr.Backpack:GetChildren()) do
table.insert(Table,v.Name)
end
if Table ~= nil then
ds1:SetAsync(plr.userId,Table)
end
end)
✓ ANSWER ACCEPTED
How do i get my Data saving script to give weapons to a player after they died?
1 answer
✓ Accepted answer
You need to put the tool into StarterGear also
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This script does work and loads up tools when i re-join however doesn't dispense the tools if the player dies