Hey,
I’m trying to attach a helmet to the player’s character with a multiple-part hat accessory.
The error:
Line 120:
Player.Character.Humanoid:AddAccessory(Helmet)
Line 217:
attachHelmet(Player, "EMSCommanderHelmet")
How would I be able to do this? I tried the following:
The function:
local function attachHelmet(Player, Helmet)
if Helmet ~= "NoHelmet" then
local helmetToAttach = ServerStorage.Helmets:FindFirstChild(Helmet)
for i = 1, #helmetToAttach:GetChildren() do
if helmetToAttach:GetChildren()[i] ~= helmetToAttach.Center then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = helmetToAttach:GetChildren()[i]
Weld.Part1 = helmetToAttach.Center
Weld.Parent = helmetToAttach.Center
helmetToAttach:GetChildren()[i].Anchored = false
end
end
Player.Character.Humanoid:AddAccessory(Helmet)
elseif Helmet == "NoHelmet" then
--delete helmet
end
end
I tried welding the accessory together, to obtain the result, but it sadly didn’t work.
This is how explorer looks like:
Any one have an idea? Thanks!