I’m wondering how to make a Image button GUI put a hat on a player if you have a answer I will put you in the credits of the game to repay you. Thank you and have a nice day! I’ll put the ID and the name of the hat if needed! Oh and beneath the info ID of the hat and name if needed is the code I tried! Sorry if its bad i’m not good at scripting!
|Use if need|
This is the ID of the hat ---------> 16725421
This is the name of the hat ---------> Fire Fighter Hazard Mask |Script|

  script.Parent.MouseButton1Click:Connect(click)
 local d = game.Players.LocalPlayer.Character
 local hat = d.Fire Fighter Hazard Mask:Clone()

function click()
   if script.Parent.selected.Visible == true then
    game.Players.LocalPlayer.Character:FindFirstChild("Fire Fighter Hazard Mask"):remove()
    game.Players.LocalPlayer.leaderstats.Hats.Value = 0
    script.Parent.selected.Visible = false
else
     hat:Clone().Parent = d
     game.Players.LocalPlayer.leaderstats.Hats.Value = 1
     script.Parent.selected.Visible = true
  end
end

|What Im saying/Trying to do| https://gyazo.com/11fdeeea743ea785e2de583d27e0e85a

3 comments

0

just put it in a invisible brick and offset it that being the cframe of the head

0

Well want I want to do is click a GUI and then it puts a hat on then takes it off because I want to play my game and do that any where.

0

like what I mean by it takes it off is that you click it again to take it off.