Hello, I’m currently working on a game that features hat givers, and the hats in the game are UGC items from the catalog. I’ve used this specific hat giver in all my previous games without any issues, but I’ve encountered a problem with it.
Here’s the issue: when players equip the hat, it appears to be equipped backwards. I’ve tried a common fix, like rotating the item in studio, but unfortunately, I haven’t been able to resolve the problem.
code for it:
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "HoodedAssassin"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1, 0.4, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.SpecialMesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new (0, 0, 0)
h.AttachmentPos = Vector3.new(0, 0.4, -0.19)
h.AttachmentRight = Vector3.new (1, 0, 0)
h.AttachmentUp = Vector3.new (0, 1, 0)
wait(5)
debounce = true
end
end```
script.Parent.Touched:connect(onTouched)
I would greatly appreciate if someone had the fix for this. Thank you
Also, I would check if the player has a head in the conditional statement above since FindFirstChild doesn’t guarantee that the character will have a head.