Textbutton For accessory

So, I wanted to make a textbutton that you can equip a halo on top of your head, when you own the badge, so can someone help me do that? I’ve tried any tutorials online and none of them helped me to achieve what I wanted.

My current script:

local hat = game.ServerStorage.Hat

script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
if player then
hat:Clone().Parent = player
end

end)

Thanks a lot!

1 Like

put the hat in replicated storage cuz since this is a button

2 Likes