Welding script went crazy on new map

Hello, Dev Forum. Today I wanted to use an old “Wardrobe System” created by PCmaster04 that can be found on toolbox to use it as an system on my map.

I have used it before (the grand roblox studio update) and it was working perfectly. But right now Weld script that connected accessories to certain parts (according to Middle) to the character, is not working as it should.

First thing that was my concern that character after picking the hat was instantly welded to it, which was caused by WeldTo.Anchored = true line (However, script with this line was working perfectly back in the day)

Here’s the full script:

local WeldTo = script.Parent.Middle

function Weld(Model)
    for i,v in pairs(Model:GetChildren()) do
        if v:IsA("BasePart") and v.Name ~= "Middle" then
            
            local Weld = Instance.new("Weld",WeldTo)
            Weld.Part0 = WeldTo
            Weld.Part1 = v
            Weld.C0 = WeldTo.CFrame:ToObjectSpace(v.CFrame)
            v.Anchored = false
        end
        Weld(v)
    end
    WeldTo.Anchored = true
end

Weld(script.Parent)
script:Destroy()

After this problem was fixed (I’ve deleted the line), next one that is my current problem that I want to solve, is that hats that were welded on top of the head back in the day, now are welded inside the head.

Older map:

Old

“New” map:

obraz

What I mean by “new” and “old”.

As I’ve stated above I’ve used this system before and it was working great, but now it is not.

However, on the old place that I still have it is working.

I have downloaded a copy of that place and reuploded it, and it was still working, but

when I’ve created a baseplate, and copied EVERYTHING from the reupload, it stopped working.

had you try to move the hat in the y-axis

Now, I’ve tried but it didn’t give any results.

obraz

obraz

using scripts you tried to move the hat in the y-axis for example

v.CFrame = v.CFrame + Vector3.new(0,WeldTo.Position.Y - v.Position.Y).Magnitude,0)

i dont know if this code works, this is an example, you could try it

This is happening to me as well, every perfectionweld script in all my items dont work properly when I copy and paste them into a different place