I'm creating a character customization menu for a custom player rig that's been rigged correctly and works swell. Upon the click of a button in a GUI, a hat is supposed to be cloned from a part and be given a mesh from a group called "meshes" in the lighting. The mesh applies to the hat just fine, and the hat spawns in, but it's supposed to parented to the player character. Instead, the hat spawns above the player and just falls onto the ground, unable to be picked up. I'm confused. The work is shown below.
function click()
local player = game.Players.LocalPlayer
local playername = player.Name
local character = game.Workspace:FindFirstChild(playername)
local children = character:GetChildren()
-- This is where I spawn the hat.
local hat3 = Instance.new("Hat")
local part3 = Instance.new("Part")
hat3.Name = "normalhair"
part3.Parent = hat3
part3.Position = character:FindFirstChild("Head").Position
part3.Name = "Handle"
part3.formFactor = 0
part3.Size = Vector3.new(1, 1, 1)
part3.BottomSurface = 0
part3.TopSurface = 0
part3.Transparency= 0
part3.Locked = true
game.Lighting.meshes.normalhair:Clone().Parent = part3
hat3.Parent = character
hat3.AttachmentPos = Vector3.new(0, 0.15, -0.08)
end
script.Parent.MouseButton1Click:connect(click)

2 comments
Why did you turn the Locked property to true? I'm pretty sure they are going to change the permission level you need to access that with so you'll get an error, and it only affects studio.
Also, stop bullying the physics engine by doing calculations that you don't want to happen D: it never done anything to you besides fling you out of a map or few