This is the code:
game.Players.PlayerAdded:Connect(function(Player)
local Char = game.Workspace:WaitForChild(Player.Name)
local Hum = Char:WaitForChild("Humanoid")
Char.ChildAdded:Connect(function(Item)
if Item:IsA("Model") then
if Item:FindFirstChild("Holder") and Item:FindFirstChild("BP") then
if Char:FindFirstChild(Item:FindFirstChild("BP").Value) then
local BodyItem = Char:FindFirstChild(Item:FindFirstChild("BP").Value)
for i,v in pairs(Item:GetChildren()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("MeshPart") then
if v.Name ~= "Holder" then
local w = Instance.new("Motor6D")
w.Part0 = v
w.Part1 = Item:FindFirstChild("Holder")
w.C1 = w.Part1.CFrame:toObjectSpace(w.Part0.CFrame)
w.Name = v.Name
w.Parent = v
elseif v.Name == "Holder" then
local w = Instance.new("Motor6D")
w.Part0 = Item:FindFirstChild("Holder")
w.Part1 = BodyItem
w.C1 = CFrame.new(0,0,0)
w.Name = "Main Holder"
w.Parent = v
end
end
end
end
end
end
end)
end)
This is the entire code ^. Below, is the lines that aren't working even though I don't get an error message. v
local w = Instance.new("Motor6D")
w.Part0 = Item:FindFirstChild("Holder")
w.Part1 = BodyItem
w.C1 = CFrame.new(0,0,0)
w.Name = "Main Holder"
w.Parent = v
