Here is my script. It gives the hat and everything, except it doesn't stick the the players head:
local debounce = true local timeinterval = 1 local mesh = script.Parent.Mesh script.Parent.Touched:connect(function(player) local humanoid = player.Parent:FindFirstChild("Humanoid") if humanoid then print("there is humanoid") if not debounce then return end debounce = false --HatGive-- local hat = Instance.new("Hat") local handle = Instance.new("Part") local newmesh = mesh:Clone() hat.Name = "GivenHatTesting" hat.Parent = player.Parent hat.AttachmentPos = Vector3.new(0, 0.6, 0) handle.Parent = hat handle.Position = player.Parent:FindFirstChild("Head").Position handle.Name = "Handle" handle.Size = Vector3.new(0,-0.25,0) handle.BottomSurface = 0 handle.TopSurface = 0 handle.Locked = true handle.formFactor = 0 newmesh.Parent = handle --HatGive-- wait(timeinterval) debounce = true end end)
why wont it weld to the characters head? ty for feedback pls
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.
-- Parents objects to character ClothingStorage.Imperials.AssaultClass.Helmet:clone().Parent = Character Character.Helmet.Handle.AccessoryWeld.Part0 = Character.Helmet.Handle Character.Helmet.Handle.AccessoryWeld.Part1 = 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
local debounce = true local timeinterval = 1 local mesh = script.Parent.Mesh script.Parent.Touched:connect(function(player) local humanoid = player.Parent:FindFirstChild("Humanoid") if humanoid then print("there is humanoid") if not debounce then return end debounce = false --HatGive-- local hat = Instance.new("Hat") local handle = Instance.new("Part") ---------------------------------------------------------- local weld = Instance.new("Weld") ---------------------------------------------------------- local newmesh = mesh:Clone() hat.Name = "GivenHatTesting" hat.Parent = player.Parent hat.AttachmentPos = Vector3.new(0, 0.6, 0) handle.Parent = hat handle.Position = player.Parent:FindFirstChild("Head").Position handle.Name = "Handle" handle.Size = Vector3.new(0,-0.25,0) handle.BottomSurface = 0 handle.TopSurface = 0 handle.Locked = true handle.formFactor = 0 newmesh.Parent = handle ---------------------------------------------------------- weld.Name = "AccessoryWeld" weld.Parent = handle weld.Part0 = handle weld.Part1 = player.Parent:WaitForChild("Head") ---------------------------------------------------------- --HatGive-- wait(timeinterval) debounce = true end end)
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. :)