so im mading a hat equip/unequip system(from gui) Here da script
but the hats keeping falling down. I need some help
local plr = game.Players.LocalPlayer
local char = plr.Character
local e = script.Parent
script.Parent.MouseButton1Click:Connect(function()
local Rd = Instance.new("Hat")
local Handle = Instance.new("Part")
Handle.Name = "Handle"
Rd.Name = "RainbowDominus"
Handle.CanCollide = false
Handle.Position = char:findFirstChild("Head").Position
Handle.formFactor = 0
Handle.Size = Vector3.new(1.045, 1.045, 1.045)
Handle.BottomSurface = 0
Handle.TopSurface = 0
Handle.Locked = true
Handle.Parent = Rd
Handle.Color = Color3.new(0, 0, 0)
game.Workspace.Mesh:Clone().Parent = Handle
Rd.Parent = char
Rd.AttachmentForward = Vector3.new(-0, -0, -1)
Rd.AttachmentPos = Vector3.new(0, 0.5, -0.2)
Rd.AttachmentRight = Vector3.new(1, 0, 0)
Rd.AttachmentUp = Vector3.new(0, 1, 0)
end)

2 comments
Please format the code so it is easier to read. Use a Code Block instead of just pasting your code in straight from Roblox Studio.
@oCrxptic I’m new here, so idk how to it btw thanks I edited it.