Your script destroys all the tools with ClearAllChildren. Instead of that you could parent them all to nil or ServerStorage, for example and then parent them to the backpack again when the player leaves the seat. Another option would be to store the names of the tools in the storedTools table and use the names to clone the correct tools from serverstorage or starterpack or wherever you have them permanently.
Here’s a modified version of your script. It parents the tools to nil and back to the backpack when necessary.
Edit: now, after it parents them to the backpack, it also replaces the stroredTools table with a new empty table.
game.Players.PlayerAdded:Connect(function(p)
local storedTools = {}
local stored = false
p.CharacterAdded:Connect(function(c)
c.Humanoid.Seated:Connect(function(sitting)
if sitting == true then
for i, tool in pairs(p.Backpack:GetChildren()) do
if tool:IsA("Tool") then
table.insert(storedTools, tool)
tool.Parent = nil
end
end
else
for i, tooltogive in pairs(StoredTools) do
if p.Backpack:FindFirstChild(tooltogive.Name) == nil then
toolToGive.Parent = p.Backpack
end
end
storedTools = {}
end
end)
end)
end)