Problem with hat not dropping on death

Hey, I’m just wondering if there’s some weird functionality with hats that I don’t know about.
This code is in a script for a hat. I’m trying to make it so when the player dies, they drop the hat.

Humanoid.Died:Connect(function() 
	
	SCP.Handle.CanCollide = true
	SCP.Parent = workspace
	SCP.Handle.Position = Head.Position
	
	SCP:SetAttribute("BeingWorn", false) 
	
end)

The problem is that I don’t know why it works when the player is wearing other hats and doesn’t work when they are not wearing any other hats at all.

I just want to know if there’s some weird functionality with humanoids or something that’s preventing the hat from being dropped. No, the character isn’t picking the hat up again because the code that parents the hat to the character doesn’t run when the player is dead.

There’s a weld inside the hat that needs to be broken, though I’d assume the weld would be broken when you move it.

My implementation here would just be to clone the hat’s handle and work from there. Much easier.

Humanoid.Died:Connect(function()
  local newHandle = SCP.Handle:Clone()

end
1 Like

Try change it CFrame, not Position.

Thanks, that worked. I just cloned a copy of the hat and parented it to the workspace.