Button doesn’t equip hat when pressed

Use this example:

script.Parent.MouseButton1Click:Connect(function(Player)
    local clone = game.ReplicatedStorage.RainbowHalo:Clone()
    Player.Character.Humanoid:AddAccessory(clone)
end)

Addaccessory doesn’t work on client side so you’ll need to adapt the function using a remote event for it to work

I just copied and used the script. It works perfectly for me, I don’t understand what the issue is

Can you send which script you used and your explorer?

And did you use it in a textbutton?

The only thing I could say is your accessory disappears when your game starts, or something else happens, and this causes it to disappear.

Do the steps, and if it is actually disappearing, there’s something wrong with your accessory.

Start the game, and check inside ReplicatedStorage.
Before pressing the text button, check it again.
After pressing it, check it again.

image
image
image

local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	local clone = game:GetService("ReplicatedStorage").RainbowHalo:Clone()
	clone.Parent = Player.Character
end)
1 Like