local char = game.Workspace:WaitForChild(script.Parent.Parent.Name)
local plr = game.Players:GetPlayerFromCharacter(char)
local debounce = false
char.Humanoid.Died:Connect(function()
print("char died")
local tools = plr.Backpack:GetChildren()
for i = 1,#tools do
if tools[i]:IsA("Tool") then
tools[i].Parent = script.Parent
end
end
end)
plr.CharacterAdded:Connect(function()
repeat wait() until char ~= nil
local savedstuff = script.Parent:GetChildren()
for i = 1,#savedstuff do
if savedstuff[i]:IsA("Tool") then
savedstuff[i].Parent = plr.Backpack
print(savedstuff[i].Parent)
end
end
end)
this script is in a folder owned by the player inside of serverscriptservice. it it supposed to recover tools for the player when they die, but it only runs once then stops working. if I disable/enable it then it works again.

2 comments
when the character dies with a tool, does it give the tool back to them? Is that what you mean by it only runs once?
I want it to give the tool back to the player every time they die, but it only runs once which is a problem.