Help me on making a hat giver tool

I’m trying to make a game where you survive but i cant really get a gas mask system that works that you can equip a gas mask.

Paste this into your brick.

script.Parent.Touched:Connect(function()
 local mask = game.ReplicatedStorage.Accessories.Gasmask
 mask:Clone()
 mask.Parent = game.Players.LocalPlayer.Character
 end)

This is just the local version, sadly.

I’m sorry i want to make it that the Tool makes it equip the accessory.

Oh. Thats easy. Just do this (oaste as a localscript inside tool)

script.Parent.Equipped:Connect(function()
 local mask = game.ReplicatedStorage.Accessories.Gasmask
 mask:Clone()
 mask.Parent = game.Players.LocalPlayer.Character
 end)

I’m sorry can you show me how to do it? do you have discord? If i just paste a LocalScript inside and paste the script in the LocalScript it doesnt work.