Help with making a tool that equips a hat when you click

  1. What do you want to achieve?
    I want to make a Tool that equips a hat when you click
  2. What is the issue?
    I can’t seem to find any tutorials on how to do this
  3. What solutions have you tried so far?
    Searched the devforum, youtube, Scriptinghelpers, Etc.

I even tried making a script of my own (it didn’t go so well)

here’s the script:

local Tool = script.Parent
debounce = true

function onTouched(hit)
if (hit.Parent:findFirstChild(“Humanoid”) ~= nil and debounce == true) then
debounce = false
h =“Hat”)
p =“Part”)
h.Name = “GreenTopHat”
p.Parent = h
p.Position = hit.Parent:findFirstChild(“Head”).Position
p.Name = “Handle”
p.formFactor = 0
p.Size =,-0.25,0)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos =,0.15,0)
debounce = true


Does anyone know how to do this?


Just create a hat and put it into ServerStrorage, and script it for its clones the hat to inside of player. Do not try to create a hat by script, that’s will need more effort. (Note: do not inside player head, inside character)

1 Like

Thanks For Replying! I’ll Give It A Try.

1 Like

So this is what I have so far



(this is the code inside the hatgiver)

This didn’t end up giving the StarterCharacter The hat. Did I do something wrong?

Edit: I just realised I made the hat in serverstorage “NightVisionGoggles” but in the script i put “HairAccessory.” However, Even after I fixed the mistake it still didn’t work.

It working (Copying from ServerStorage) perfectly on me.
Try my tool example i created for you (I will delete that after my solution worked)

Problem in your script is game.StarterPlayer is doesn’t able to give you localplayer. You should use RemoteEvent for creating tools like that! Note: “ServerStorage.a” is hat i used to create example.

1 Like

Thanks For letting me look at that code! It Worked.

Edit: Forgot to say you can delete the tool now

Thank you, I needed it too!