local hat = game.ServerStorage["Commander+"]

script.Parent.Touched:Connect(function(h)
	local plr = game.Players:GetPlayerFromCharacter(h.Parent)
	if plr then
		if not h.Parent:FindFirstChild("Commander+") then
			hat:Clone().Parent = h.Parent
		end
	end
end)

I'm trying to make it give the player a hat that is an accessory in ServerStorage (the hat itself is an union) there is no errors in the console or the script itself but it still doesn't work