Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to make a certain hat in a certain players inventory GUI to equip and wear?

Asked by 9 days ago

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.

0
So , Pete , You only want a Certain or Special Player to where this hat? Tizzel40 225 — 9d
0
Yes PeteHyper -3 — 9d
0
You mean: Where meaning wear? PeteHyper -3 — 9d
0
Sooo can u help me? PeteHyper -3 — 9d

1 answer

Log in to vote
0
Answered by 9 days ago
Edited 9 days ago

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)
0
Thank you very much :D PeteHyper -3 — 9d
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 PeteHyper -3 — 9d
0
You are welcome NathanBlox_Studios 100 — 9d
Ad

Answer this question