Hi my name PeteHyper and I have been wondering how to make a hat in a inventory GUI for a certain player to equip a certain custom hat when ever they join it’s still there? Help. I’m not a great Scripter I’m just a very beginner Scripter.
✓ ANSWER ACCEPTED
How to make a certain hat in a certain players inventory GUI to equip and wear?
1 answer
✓ Accepted answer
Put a localscript in the button, put the hat in replicated storage and type the following.
!!Be sure to remove all hats on the player!!
local hat = game.ReplicatedStorage.Hat -- Change to hat name
local button = script.Parent
button.MouseButton1Click:Connect(function()
local char = game.Players.LocalPlayer.Character
if char ~= nil then
local clone = hat:Clone()
clone.Parent = char
clone.Name = "Hat" -- Change to hat name
end
end)
EDIT : if you want to make a equip and unequip, create a boolean value in the button and set it to false, then type the following
local hat = game.ReplicatedStorage.Hat -- Change to hat name
local button = script.Parent
local boolean = script.Parent.BooleanValue --Change to the name of the value
button.MouseButton1Click:Connect(function()
if boolean == false then
local char = game.Players.LocalPlayer.Character
if char ~= nil then
local clone = hat:Clone()
clone.Parent = char
print("Equipped")
end
button.Text = "Unequip"
else
local char = game.Players.LocalPlayer.Character
if char ~= nil then
local clonedhat = char:WaitForChild("Hat") --Rename to hat name
clonedhat:Destroy()
print("Unequipped")
end
button.Text = "Equip"
end
end)
3 comments
0
Thank you very much :D
0
Can u make it only for like a special or certain play that can wear the hat and also the certain player can equip / Unequip
0
You are welcome
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
So , Pete , You only want a Certain or Special Player to where this hat?
Yes
You mean: Where meaning wear?
Sooo can u help me?