Hat giver issue!

So I want to make a uniform and hat giver. I already made the uniform giver part but I’m having a few issues with the hat.

Video:
https://gyazo.com/44f3d0e6f49f3582ad63a7a3915e85a6

So maybe some of y’all can help?
I’ve already tried using cap.Position = Vector3.new(…)

Would putting the accessory in ReplicatedStorage and then cloning it to the player’s character fit what you want to do?

I’m trying to make it sit on the characters head

If cap is an accessory then add it through humanoid humanoid:AddAccessory()

It’s not an accessory… Sadly, anything else that would set the model on the characters head?

You can make it accessory. Just make the infrastructure like accessory. Trust me that would fix you alot of hussle…

Other solution is just using Motor6D…

The problem of motor6D is that it will place cap in the center of head

Doesn’t a accessory require a Handle?

You can rename meshpart or part to Handle

I tried, it still dint work.

Isn’t there an easy solution to this ?

I think the problem is you don’t have HatAttachment in Handle

How do I get one of those ?

Is it just an “Attachment” ?

Yes, it’s just a renamed attachment

Anything I need to change in the script?
Here is the full script(uniform part is already working btw)
´´lua
local clickpart = script.Parent.resource.ClickPart
local Pants = script.Parent.resource.RankShirts.Pants
local s = script.Parent.resource.RankShirts
local gid = 14596202

– Shirts
local lt = s.LT_shirt
local slt = s.SLT_shirt
local cpt = s.CPT_shirt
local maj = s.MAJ_shirt
local mgen = s.MGEN_shirt

– Cap Function

game.Players.PlayerAdded:Connect(function(plr)

clickpart.ClickDetector.MouseClick:Connect(function()
	if plr:GetRankInGroup(gid) == 11 then
		plr.Character.Shirt.ShirtTemplate = lt.ShirtTemplate
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
	elseif plr:GetRankInGroup(gid) == 12 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = slt.ShirtTemplate
	elseif plr:GetRankInGroup(gid) == 13 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate
	elseif plr:GetRankInGroup(gid) == 14 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = maj.ShirtTemplate


	elseif plr:GetRankInGroup(gid) == 18 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = mgen.ShirtTemplate








	elseif plr:GetRankInGroup(gid) == 255 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate



		-- Cap Giver
		local cap = script.Parent.resource.Cap
		local primary = cap.Block
		local blockWeld = primary.WeldConstraint
		--
		local newCap = cap:Clone()
		blockWeld.Part1 = plr.Character.Head

		newCap.Parent = plr.Character.Head

	end
end)

end)
``

For accessories use:

local cap = script.Parent.resource.Cap
local newcap = cap:Clone
local plr = game.Players.PlayerAdded:Wait()
plr.CharacterAdded:Connect(function(char)
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
humanoid:AddAccessory(newcap)
end)

Make sure cap is accessory and has HatAttachment in Handle
Hope it helped

And then make the cap an accessory and name a part “Handle”?

Now nothing happens when I click…

clickpart.ClickDetector.MouseClick:Connect(function(plr)
	if plr:GetRankInGroup(gid) == 11 then
		plr.Character.Shirt.ShirtTemplate = lt.ShirtTemplate
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
	elseif plr:GetRankInGroup(gid) == 12 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = slt.ShirtTemplate
	elseif plr:GetRankInGroup(gid) == 13 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate
	elseif plr:GetRankInGroup(gid) == 14 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = maj.ShirtTemplate


	elseif plr:GetRankInGroup(gid) == 18 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = mgen.ShirtTemplate








	elseif plr:GetRankInGroup(gid) == 255 then
		plr.Character.Pants.PantsTemplate = s.Pants.PantsTemplate
		plr.Character.Shirt.ShirtTemplate = cpt.ShirtTemplate



		-- Cap Giver
		local cap = script.Parent.resource.Cap
		--
		local newCap = cap:Clone()
		plr.Character:FindFirstChildWhichIsA("Humanoid"):AddAccessory(newcap)

	end
end)

I noticed that you have a clickdetector