#Script/my skill issue problem

1 messages · Page 1 of 1 (latest)

opal wasp
#
local ChrTools = {}

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")

        if ChrTools[Player] then
            local backpack = Player:WaitForChild("Backpack")

            for _, item in ipairs(backpack:GetChildren()) do
                if item:IsA("Tool") then
                  --item:Destroy()
                end
            end

            for _, toolData in ipairs(ChrTools[Player].tools) do
                local newTool = toolData.tool:Clone()
                newTool.Parent = backpack
            end
            ChrTools[Player] = nil
        end

        Humanoid.Died:Connect(function()
            ChrTools[Player] = {
                tools = {}
            }

            local backpack = Player:WaitForChild("Backpack")

            for _, tool in ipairs(backpack:GetChildren()) do
                if tool:IsA("Tool") then
                    table.insert(ChrTools[Player].tools, {
                        tool = tool:Clone()
                    })
                end
            end
        end)
    end)
end)

Players.PlayerRemoving:Connect(function(Player)
    if ChrTools[Player] then
        for _, toolData in ipairs(ChrTools[Player].tools) do
            if toolData.tool and toolData.tool.Parent then
                toolData.tool:Destroy()
            end
        end
        ChrTools[Player] = nil
    end
end)```.     This script saves the tools of the player's backpack/inv it works of the player touches a kill brick or gets kill by something in the GAME but doesn't work when you reset character PLS help me i've been stuck on this for a while
onyx fractal
opal wasp
#

no

#

i made a script that gives out tools when players join

onyx fractal