I had the same problem you are having for almost 2 weeks. I think I may be able to help.
So heres the code I use for my script. Just for you to look at, maybe bounce some ideas off of.
2 | ClothingStorage.Imperials.AssaultClass.Helmet:clone().Parent = Character |
3 | Character.Helmet.Handle.AccessoryWeld.Part 0 = Character.Helmet.Handle |
4 | Character.Helmet.Handle.AccessoryWeld.Part 1 = Character.Head |
What is does is it goes into ClothingStorage which is a folder inside ReplicatedStorage for me.
Then it parents the helmet to the character. The helmet is an accessory, it has all the parts inside it including a weld script and a handle.
Inside the handle is a weld.
It sets the welds to the helmet and then the other weld to the head.
Now back to you
Looking back at your script, it seems no where in your script do you actually create the weld.
So lets do that now :)
Anywhere there is a ------------- That means I have added that line
03 | local mesh = script.Parent.Mesh |
05 | script.Parent.Touched:connect( function (player) |
06 | local humanoid = player.Parent:FindFirstChild( "Humanoid" ) |
08 | print ( "there is humanoid" ) |
14 | local hat = Instance.new( "Hat" ) |
15 | local handle = Instance.new( "Part" ) |
17 | local weld = Instance.new( "Weld" ) |
19 | local newmesh = mesh:Clone() |
20 | hat.Name = "GivenHatTesting" |
21 | hat.Parent = player.Parent |
22 | hat.AttachmentPos = Vector 3. new( 0 , 0.6 , 0 ) |
24 | handle.Position = player.Parent:FindFirstChild( "Head" ).Position |
25 | handle.Name = "Handle" |
26 | handle.Size = Vector 3. new( 0 ,- 0.25 , 0 ) |
27 | handle.BottomSurface = 0 |
31 | newmesh.Parent = handle |
33 | weld.Name = "AccessoryWeld" |
36 | weld.Part 1 = player.Parent:WaitForChild( "Head" ) |
Tell me if that works, I am not the best scripter in the world. So if it doesnt work then comment and ill see if I can fix it. :)