I tried this code but didn't work:
function deletePlayersItens()
local player = game.Players:GetPlayers()
for _, tool in ipairs(player.Backpack:GetChildren()) do
if tool:IsA("Tool") then
tool:Destroy()
end
end --Deletes all tools from Backpack
if player.Character:FindFirstChildOfClass("Tool") then
player.Character:FindFirstChildOfClass("Tool"):Destroy()
end --Deletes Equipped Tool
end
Error: ServerScriptService.MainScript:14: attempt to index nil with 'GetChildren' - Server - MainScript:14
Please someone help me, also I need it to delete equipped itens as it needs to reset to get back to the lobby.

1 comment
worked thx a lot