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)
By going into studio, playing and then looking at hat structure I can see you missed the weld. http://prntscr.com/gtwr6z shows there are 2 extra objects in the handle. Small things like this can help find out why things dont work.