Hello! I made a script that makes it so that whenever a player clicks a button, a hair accessory appears onto them, but I get this error
Expected BasePart got Accessory for Weld:Part1.
Here is my script:
game.ReplicatedStorage.Events.HairEvent1.OnServerEvent:Connect(function(plr)
local Storage = game.ReplicatedStorage.Hair.Hair1
local char = plr.Character
if char:FindFirstChild("Humanoid") then
local Folder = char.Head.Hair
Folder:ClearAllChildren()
local head = char.Head
local New_Hair = Storage:Clone()
New_Hair.Parent = Folder
New_Hair.AttachmentPos = head.Position
local Weld = Instance.new("Weld")
Weld.Parent = New_Hair
Weld.Part0,Weld.Part1 = head, New_Hair
Weld.C0 = CFrame.new(0,0,6,0)
Weld.C1 = head.HairAttachment.CFrame
end
end)
sorry it is very late where I live and I just wanted to get this done before I go to bed because I am tired. I still don’t understand it though how do I do that?
game.ReplicatedStorage.Events.HairEvent1.OnServerEvent:Connect(function(plr)
local Storage = game.ReplicatedStorage.Hair.Hair1
local char = plr.Character
if char:FindFirstChild("Humanoid") then
local Folder = char.Head.Hair
Folder:ClearAllChildren()
local head = char.Head
local New_Hair = Storage:Clone()
New_Hair.Parent = Folder
New_Hair.AttachmentPos = head.Position
local Weld = Instance.new("Weld")
Weld.Parent = New_Hair
Weld.Part0,Weld.Part1 = head, New_Hair.Handle
Weld.C0 = CFrame.new(0,0,6,0)
Weld.C1 = head.HairAttachment.CFrame
end
end)
also why are you using welds and not weldconstraints??
I found welds easier as this is what I’ve used before. I don’t think there is a big difference between the 2 but I just feel more comfortable using welds. Thank you for the help btw, I am just really tired