Hey, So I am working on my latest project right now and it also includes a main menu, in the main menu there is an option to the armour. The armour argument given in the following function is a model with parts with names and sizes of the character parts. When I run it, the player teleports from their spawn to the point where the armour was before. (possibly a weld issue?)
It will be very appriciated if you can help ![]()
function weldallchildren(part)
local d = part:GetDescendants()
for i=1,#d do
if d[i]:IsA('BasePart') then
d[i].Anchored = true
local weld = Instance.new("WeldConstraint")
weld.Parent = part
weld.Part0 = part
weld.Part1 = d[i]
d[i].CanCollide = false
d[i].Anchored = false
end end
end
function addArmour(plr,armour)
--local ac = armour:SetPrimaryPartCFrame()
if armour:GetChildren()[1] ~= nil then
wait(1)
local narmour = armour:Clone()
narmour.Parent = workspace
local nc = narmour:GetChildren()
for i=1,#nc do
if plr.Character:FindFirstChild(nc[i].Name) and nc[i]:IsA('BasePart') and plr.Character:FindFirstChild(nc[i].Name):IsA('BasePart') then
print('Hi')
plr.Character:FindFirstChild(nc[i].Name).Anchored = true
nc[i].Anchored = true
weldallchildren(nc[i])
nc[i].CFrame = plr.Character:FindFirstChild(nc[i].Name).CFrame
local weld = Instance.new("WeldConstraint")
weld.Part0 = plr.Character:FindFirstChild(nc[i].Name)
weld.Part1 = nc[i]
weld.Parent = plr.Character:FindFirstChild(nc[i].Name)
nc[i].Parent = plr.Character:FindFirstChild(nc[i].Name)
nc[i].Transparency = 1
wait()
nc[i].Anchored = false
nc[i].CanCollide = false
plr.Character:FindFirstChild(nc[i].Name).Anchored = false
elseif nc[i].Name == 'face' and nc[i]:IsA('Decal') then nc[i]:Destroy() end
end
wait(1)
narmour:Destroy()
end