Hat Dropping Script Wont Work

Hi, I’m trying to make a system like what Roblox had a long time ago, where you press = and it drops your hats, I’m trying to make a script to replicate this. However, when I drag the hats into workspace, they stay on my character when it’s supposed to drop. How do I fix this?

1 Like

You have to remove the welds, or try to remove the attachments

then makes hats collideable

Hi! Try this:

Create a local script in StarterGui

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character ~= nil
local char = plr.Character

game.UserInputService.InputBegan:Connect(function(inp, t)
	if not t then
		if inp.KeyCode == Enum.KeyCode.Equals then
			for i,v in pairs(char:GetChildren()) do
				if (v:IsA("Accessory") and v.AccessoryType == "Hat") or v:IsA("Hat") then
					local h = v.Handle
					h.Parent = workspace
					h.HatAttachment:Destroy()
					h.AccessoryWeld:Destroy()
					h.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,0,-5)
					h.CanCollide = true
					h.Anchored = false
				end
			end
		end
	end
end)

I tried this script but the hats seem to freeze until I collide with them, do you know the cause of this issue?

I have no idea why does this happen, lol