Make Hats Unable To Be Dropped

For Ultimate Boxing, I had two options for hats: Remove them on being dropped or make them unable to be dropped. I was able to write a fairly short script to do this by reparenting the Handles to the character and cloning the welds.

[code]
local function CharacterAdded(Character)
if Character then
local Head = Character:WaitForChild(“Head”)

	local function InstanceAdded(Ins)
		if Ins:IsA("Hat") or Ins:IsA("Accessory") or Ins:IsA("Accoutrement") then
			delay(0,function()
				local Handle = Ins:WaitForChild("Handle")
				
				local AccessoryWeld = Handle:FindFirstChild("AccessoryWeld")
				if AccessoryWeld then
					local NewWeld = AccessoryWeld:Clone()
					Handle.Parent = Character
					NewWeld.Parent = Handle
					Ins:Destroy()
				else
					local HeadWeld
					for _,Weld in pairs(Head:GetChildren()) do
						if Weld:IsA("Weld") and Weld.Part1 == Handle then
							HeadWeld = Weld
							break
						end
					end
					
					if HeadWeld then
						local NewWeld = HeadWeld:Clone()
						Handle.Parent = Character
						NewWeld.Parent = Handle
						Ins:Destroy()
					end
				end
			end)
		end
		
		Ins.ChildAdded:connect(InstanceAdded)
		for _,NIns in pairs(Ins:GetChildren()) do
			InstanceAdded(NIns)
		end
	end
	
	InstanceAdded(Character)
end

end

local function PlayerAdded(Player)
if Player then
Player.CharacterAdded:connect(CharacterAdded)
CharacterAdded(Player.Character)
end
end

game.Players.PlayerAdded:connect(PlayerAdded)
for _,Player in pairs(game.Players:GetPlayers()) do
PlayerAdded(Player)
end[/code]

Supports both Hats and Accessories. Didn’t really have a reason to keep it closed source, I just wish we had a supported method to prevent the = key being bounded to drop hats to start.

5 Likes

My greatest wish regarding hats is the ability to pick up 3 hats at once. Once you drop em, you’re committed to one

11 Likes

I don’t even see why this feature exists, why would I want to drop all my hats? To swap them with someone else in game? Seems very weird and specific. For fashion games? I think the developers of those should figure that out easily.

What is the purpose of hats falling off?

@AbstractAlex I made a public model to do just that a while back. You can pick up up to 3 hats and you click to equip them so you don’t accidentally do it.

1 Like

Yes, better yet we should improve the character system so you can click on which hats you want to pick up instead of automatically putting on the first one that touches you.

1 Like

Hat clicker: the fun interactive game where you click to equip hats falling from the sky, before they fall into the lava! The winner is the one wearing the most hats by the end.

2 Likes

This honestly sounds like an entertaining game idea, with a little gameplay work we could have Hat Stack: The Game.

Also, I came up with a proposal: add a “Pickup” bool property to Accessory which enables whether or not a player can wear it if they are close enough to said accessory.

I always thought it was a fun social feature. That NPC there? He’s gonna wear my hat. That orc? My hat’s going on him. That guest who has no hat? Now he has one. I hatted people all day.

7 Likes

It’s especially great now that NBC players have such a limited selection of hats. They can liven up their bland wardrobe just by interacting with other players.

Back in the day, there used to be “hat bins” that you could drop your hat into, and after a few players did so, you could try on a couple different hats before going to work in the bread factory.

4 Likes