Holster system not working

At the current time, there was an issue with one of my friend’s gun systems, because the holster system he made didn’t work as intended.

It creates the clone but the positioning doesn’t go as he wanted.
When he unequips the gun, the gun stays at the position it was at before the unequip.
image

I was trying to help but I dont know how.
His script that creates the clone;

    local player = tool.Parent.Parent
    local torso = player.Character:FindFirstChild("Torso")
    if torso then
        local toolModel = tool:FindFirstChildi("ToolModel")
        if toolModel and toolModel.PrimaryPart ~= nil then
            warn("Found ToolModel")
            local VisibleTool = toolModel:Clone()
            VisibleTool.Parent = torso
            --VisibleTool.PrimaryPart.CFrame = torso.CFrame
            for _,part in pairs(VisibleTool:GetChildren()) do
                if part:IsA("MeshPart") or part:IsA("Part") then
                    part.CanCollide = false
                    if part.Name ~= VisibleTool.PrimaryPart.Name then
                        local Weld = Instance.new("WeldConstraint", part)
                        Weld.Part0 = part
                        Weld.Part1 = VisibleTool.PrimaryPart
                    else
                        local Weld = Instance.new("WeldConstraint", part)
                        Weld.Part0 = part
                        Weld.Part1 = torso
                    end
                else
                    part:Destroy()
                    warn("Found an instance that was not a part of the model")
                end
            end
            warn("Added ToolModel to torso")
        else
            if not toolModel then
                warn("No ToolModel found, can't support weapon visibility.")
            elseif toolModel.PrimaryPart == nil then
                warn("No ToolModel PrimaryPart")
            end
        end
    end

The PrimaryPart to torso was a test, and did not WORK
image
How would this be fixed?

2 Likes