Hello, I have Weld script that activates when the player picks certain item in the inventory. But when it copies the armor (Model) from the replicated storage and into the player I get a glitchy result. I hope you guys can help me out:
local function weld(a,b) local w = Instance.new("ManualWeld", b) w.Name = a.Name.."_Weld_"..b.Name w.C0 = a.CFrame:inverse() * b.CFrame w.Part0 = a w.Part1 = b end local function weldModel(item_model, char) for i,v in pairs(item_model:GetChildren()) do if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("MeshPart") then local weldTo = char:FindFirstChild(v.Name) if weldTo then weld(v, weldTo) end v.Anchored = false end end end _G.EquipItem = function(char) local item = game.ReplicatedStorage.Items:FindFirstChild(item_name) if item then if char:findFirstChild(item_name) then char:findFirstChild(item_name):Destroy() end for i,v in pairs(item:getChildren()) do if v:IsA("Model") then local item_model = v:Clone() item_model.Parent = char item_model:SetPrimaryPartCFrame(char.Head.CFrame) weldModel(item_model,char) end end end end