Why won't hat button in GUI make hat stay on player?
Hi there, I am still working on a player customizer GUI, and I made a hat GUI for it. Well, it was all working perfectly until I can't remember what happened. It does work, yes, but not how I want it. You see, when you press a button, the hat goes on the player, but then disappears. Here's the script:
01 | Player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent |
02 | Human = Player.Character |
06 | function onClicked(mouse) |
08 | if debounce = = true then |
10 | Hat = Instance.new( "Accessory" ) |
11 | Handle = Instance.new( "Part" ) |
13 | Handle.Name = "Handle" |
15 | Handle.Position = Human:findFirstChild( "Head" ).Position |
17 | Handle.Size = Vector 3. new( 1 , 1 , 1 ) |
20 | script.Parent.Mesh:clone().Parent = Handle |
22 | Hat.AttachmentForward = script.Parent.AttachmentForward.Value |
23 | Hat.AttachmentPos = script.Parent.AttachmentPos.Value |
24 | Hat.AttachmentRight = script.Parent.AttachmentRight.Value |
25 | Hat.AttachmentUp = script.Parent.AttachmentUp.Value |
31 | script.Parent.MouseButton 1 Click:connect(onClicked) |
Keep in mind that it is in StarterGUI and that it does work but disappears the next second. It's also in a normal script, not local, but I tried making it in local and had the same outcome.
Thank you!